Search code examples
iosobjective-camazon-s3video-streamingmpmovieplayercontroller

MPMoviePlayerController for remote file on Amazon S3


My app allows videos to be displayed in UITableViewCells on iOS.

I'm currently storing my video files in Amazon S3 and utilizing Cloudfront. I got this code from the Apple docs:

MPMoviePlayerController *player =

        [[MPMoviePlayerController alloc] initWithContentURL: myURL];

[player prepareToPlay];

[player.view setFrame: myView.bounds];  // player's frame must match parent's

[myView addSubview: player.view];

// ...

[player play];

I have implemented this code pretty much exactly into my own app. For some reason, it does not seem to work for me. I think it may have something to do with not having JWPlayer installed in my S3 bucket.

My question is: In order to display a video in the app that allows playing while loading the remaining contents of the video in the background, do I need to have JWPlayer in my S3 bucket?...or is this unnecessary given the use of MPMoviePlayerController.

Thanks!


Solution

  • Well the problem is that the MPMoviePlayerController can't play that file because is not streamed. [[MPMoviePlayerController alloc] initWithContentURL: myURL]; expects a network stream, in your case is not a network stream. What you could do, is download the file and save it in your app documents files and play it from there.