Reducing the initial delay when playing remote video content

蓝咒 提交于 2020-01-29 09:49:49

问题


Hi using MPMoviePlayerController to stream video into the app. However, it takes a long time to load and I want to be able to pre-buffer the video. Any suggestions?


回答1:


  1. Use [MPMoviePlayerControllerInstance prepareToPlay] as soon as you know that the user might start playback of a movie. You might also want set MPMoviePlayeController.autoPlay to something that fits best, depending on your application.

    From Apple's Documentation;

    This method is called automatically when you call the play method. Calling it before you call play gives the receiver a chance to prepare items sooner and may result in decreased latency when starting playback. However, calling this method may also interrupt any active audio sessions.

  2. Make sure your HTTP stream contains a low bandwidth alternative using less than 64Kbps (audio and video combined). Note that the MPMoviePlayerController usually starts buffering the low rate playback index profile before raising the bar and attempting to load higher bandwidth profiles. It will be prepared to play once it has a few seconds worth of movie data.

  3. Use the MPMoviePlayerController.movieSourceType property when initializing your player to cut down the media recognition delay.

    From the MPMoviePlayerController Class Reference:

    The default value of this property is MPMovieSourceTypeUnknown. This property provides a clue to the playback system as to how it should download and buffer the movie content. If you know the source type of the movie, setting the value of this property before playback begins can improve the load times for the movie content. If you do not set the source type explicitly before playback, the movie player controller must gather this information, which might delay playback.



来源:https://stackoverflow.com/questions/6549967/reducing-the-initial-delay-when-playing-remote-video-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!