objective c - Initial video stream play slow (MPMoviePlayerViewController) in ios app -
in our ios app users can upload , play videos.
- we using aws s3 bucket store videos.
- aws cloudfront cdn.
all videos accessing through cdn url. example : https://dnxrwxxxxxx.cloudfront.net/1417696382abc.mp4.
as checked there no issue cdn , internet connection. when play video in html player in browser there no issue.
but problem when click 1 video taking long time play. can see loading.after start play video playing smoothly. issue initial loading.
here 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 original cloud front url. if video available in cache load cache source type mpmoviesourcetypefile. or else stream url source type mpmoviesourcetypestreaming. using http live streaming (hls).
these videos caching , there no issue playing cached video.