简体   繁体   English

带有流视频或 NSFileHandle 的 AVPlayer

[英]AVPlayer with Streaming videos or NSFileHandle

In my app I need to play multiple videos one after another.在我的应用程序中,我需要一个接一个地播放多个视频。 Currently, I am streaming the videos using AVPlayer but its seems very laggy, the videos freeze quite often.目前,我正在使用AVPlayer流式传输视频,但它似乎非常滞后,视频经常冻结。 I'm wondering if downloading the files with NSFileHandle will provide a better user experience with less lagging.我想知道使用NSFileHandle下载文件是否会提供更好的用户体验,减少滞后。 BUT, Im worried about memory issues.但是,我担心内存问题。

Does anyone have any recommendations in which way is more efficient?有没有人有任何建议,哪种方式更有效? Or, for example, how snapchat plays such a large number of videos so smoothly.或者,例如,snapchat 如何如此流畅地播放如此大量的视频。 Thanks.谢谢。

To control the playback of assets, you use an AVPlayer object.要控制资产的播放,您可以使用 AVPlayer 对象。 During playback, you can use an AVPlayerItem instance to manage the presentation state of an asset as a whole, and an AVPlayerItemTrack object to manage the presentation state of an individual track.在播放过程中,您可以使用 AVPlayerItem 实例来管理资产的整体呈现状态,并使用 AVPlayerItemTrack 对象来管理单个轨道的呈现状态。 To display video, you use an AVPlayerLayer object.要显示视频,请使用 AVPlayerLayer 对象。 enter link description here 在此处输入链接描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM