减少播放远程视频内容时的初始延迟 [英] Reducing the initial delay when playing remote video content

查看:95
本文介绍了减少播放远程视频内容时的初始延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您正在使用MPMoviePlayerController将视频流式传输到应用中。但是,加载需要很长时间,我希望能够预先缓冲视频。有什么建议吗?

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. 使用
    [ MPMoviePlayerControllerInstance prepareToPlay]
    一旦你知道用户
    可能开始播放电影。你
    也可能想要设置
    MPMoviePlayeController.autoPlay
    最合适的东西,取决于你的应用程序上的

  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.

来自 Apple的文档;


此方法称为
当你调用play
方法时自动b。在你拨打
play之前给它打电话让接收器有机会更快地准备
准备项目,并且在开始
播放时可能导致
减少延迟。但是,调用此方法
也可能会中断任何活动音频
会话。

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.


  • 确保您的HTTP流包含
    a低带宽备用,使用
    小于64Kbps(音频和视频组合)。请注意,
    MPMoviePlayerController 通常
    开始缓冲低价
    回放索引配置文件,然后
    提高标准并尝试
    加载更高的带宽配置文件。一旦它有
    a几秒钟的电影数据,它就会准备播放。

  • 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.

    使用
    MPMoviePlayerController.movi​​eSourceType
    属性初始化你的
    玩家以减少媒体
    识别延迟。

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

    来自 MPMoviePlayerController
    类参考


    此属性的默认值为
    MPMovieSourceTypeUnknown。这个
    属性为
    播放系统提供了一个线索,说明它应该如何下载和缓冲电影内容。
    如果你知道
    电影的源类型,在播放开始前设置这个
    属性的值可以
    改善电影
    内容的加载时间。如果您在播放前未明确设置源
    类型,
    电影播放器​​控制器必须收集
    此信息,这可能会延迟
    播放。

    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.


  • 这篇关于减少播放远程视频内容时的初始延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆