开发者

Reducing the initial delay when playing remote video content

开发者 https://www.devze.com 2023-03-16 22:43 出处:网络
Hi using MPMoviePlayerController to s开发者_如何学Ctream 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?

Hi using MPMoviePlayerController to s开发者_如何学Ctream 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. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消