Video Streaming (LectureConnect) - RITAccess/accessmath GitHub Wiki

LectureConnect is the server side of AccessMath. It handles streaming lectures to devices, managing lecture instances, and the hosting of the admin console. The live testing server management console sits at http://michaeltimbrook.com:3000 and the socket connections are received on port 9000.

Setup

  1. Switch on video recording on the Camera. Make sure it is connected to the Black Magic MiniRecorder.
  2. Plug the Thunderbolt cable of the MiniRecorder into the machine that will be hosting the RTMP server.
  3. Run the RTMP nginx server on that machine.
  4. Now use ffmpeg to convert the RTMP stream to HTTP live stream (HLS). iOS only supports HLS.
  5. Spin up an HTTP server (we've used Mongoose)
  6. Use the IP of the machine that's hosting the HTTP server for streaming
  7. Ensure that this IP is added to the playSampleClip() function within LectureViewContainer:
- (void)playSampleClip {
    [self playStream:[NSURL URLWithString:@"http://129.21.175.19:8080/stream/live.m3u8"]];
}

Wants? Any delegate methods that you want please submit an issue and assign it to me. (7imbrook)

Example Modes

UIWebView

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/

  • UIWebView is quick and will allow for multiple searches if you want to click through the video to other videos to persist.
  • Allows for both a normal url and embedded of the two
  • Cannot give single instance of a video(needs to load from the internet)
  • Can continue with other videos after with youtube links

Example code snippet of video using embedded code in UIWebView in the implementation file under DidLoadView:

NSString *embedCode = @"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/mDFKyp40XUc\" frameborder=\"0\" allowfullscreen></iframe>";

[[self myWebView]loadHTMLString:embedCode baseURL:nil];

Example of using the NSURL to load a video under the implementation file under DidLoadView (With this method, this take the whole page unless stated otherwise within the link):

NSURL *url = [NSURL URLWithString:@"https://www.youtube.com/watch?v=tZqtHmTcvF4"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [[self myWebView] loadRequest:request];

MPMoviePlayerViewController

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerViewController_class/

  • Allows for both urls to be inputted, as well as local videos to be played.
  • Local videos need to be within the package themselves(i.e the app folder with the other resources)

Supported Formats This class plays any movie or audio file supported in iOS. This includes both streamed content and fixed-length files. For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:

  • H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. (The Baseline profile does not support B frames.) 
  • MPEG-4 Part 2 video (Simple Profile)  If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

Example of MPMoviePlayerViewController code snippet from the implementation file:

http://stackoverflow.com/questions/20458711/mpmovieplayerviewcontroller-is-not-playing-video-from-url

  _moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"http://nordenmovil.com/urrea/InstalaciondelavaboURREAbaja.mp4"]];
  _moviePlayer.view.frame = CGRectMake(0, 0, 500, 500);
  _moviePlayer.moviePlayer.shouldAutoplay=YES;

  _moviePlayer.moviePlayer.movieSourceType= MPMovieSourceTypeFile;
  [_moviePlayer.moviePlayer setControlStyle:MPMovieControlStyleDefault];

  [self.view addSubview:_moviePlayer.view];
  [_moviePlayer.moviePlayer play];

Current Version Using this functionality for iOS: 8.3

⚠️ **GitHub.com Fallback** ⚠️