Initial video stream is slow (MPMoviePlayerViewController) in ios app

In our ios app, users can download and play videos.

  • We are using AWS S3 bucket to store videos.
  • AWS Cloudfront is a CDN.

all videos will be available through the CDN URL. Example: https://dnxrwXXXXXX.cloudfront.net/1417696382ABC.mp4 .

as we checked, there is no problem with CDN and internet connection. when we play this video in HTML player in browser, no problem.

but the problem is when we click on one video it takes a long time to play. only we see that it is loading. After starting video playback, the game is smooth. boot problem.

here is the code

MPMovieSourceType sourceType;
    NSURL *currentURL = [[VideoDiskCache getSharedInstance] searchCash:urll];
    if (!currentURL) {
        currentURL = urll;
        sourceType = MPMovieSourceTypeStreaming;
    } else {
        sourceType = MPMovieSourceTypeFile;
    }
    moviePlayerController = [[MPMoviePlayerViewController alloc]
                initWithContentURL:currentURL];
    moviePlayerController.view.superview.backgroundColor = [UIColor blackColor];
    moviePlayerController.view.superview.superview.backgroundColor = [UIColor blackColor];
    moviePlayerController.view.superview.superview.backgroundColor = [UIColor blackColor];
    moviePlayerController.view.backgroundColor = [UIColor blackColor];
    moviePlayerController.moviePlayer.movieSourceType = sourceType;
    [AppDelegate getAppDelegate].navigationController.view.backgroundColor = [UIColor blackColor];
    [[AppDelegate getAppDelegate].navigationController presentMoviePlayerViewControllerAnimated:moviePlayerController];

      

Here url means the original cloud front. If the video is available in the cache, we load it from the cache with the source type MPMovieSourceTypeFile. Or else we will pass from a URL with the original MPMovieSourceTypeStreaming. we also use HTTP streaming live streaming (HLS).

these videos are cached and there is no problem with playing the cached video.

+3
ios objective-c amazon-s3 amazon-web-services mpmoviewcontroller


source to share


No one has answered this question yet

Check out similar questions:

22
How to set up S3 and Cloud Front for HTML5 video streaming? Tried everything
ten
Streaming video while loading iOS
6
ios: play video with arbitrary nsinputstream
4
Swift 3: How to set multiple JWPlayer cookies for HLS streaming
3
AWS S3 Video Stream
1
CrossDomain Access, HLS over CloudFront with signed URL (JWplayer)
1
Best Android / iOS Video Streaming Option AWS
0
AWS CloudFront Content Not Available Immediately
0
Streaming video from S3 is choppy
-2
Amazon S3 streaming issue



All Articles
Loading...
X
Show
Funny
Dev
Pics