是否可以使用presentMoviePlayerViewControllerAnimated 播放多个剪辑?
我有一种情况,我想使用使用presentMoviePlayerViewControllerAnimated 显示的MPMoviePlayerViewController 来连续播放2 个视频剪辑。
问题是,第一部电影完成后,模态视图会自动关闭。
有没有人找到办法做到这一点?
I have a situation where I'd like to play 2 video clips back to back using an MPMoviePlayerViewController displayed using presentMoviePlayerViewControllerAnimated.
The problem is that the modal view automatically closes itself as soon as the first movie is complete.
Has anyone found a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
三个选项:
您可以使用
MPMoviePlayerController
并在前一个项目完成后开始播放第二个(第 N 个)项目。然而,由于内容的识别和预缓冲,这将在视频之间引入小间隙。您可以使用
AVQueuePlayer
; AVQueuePlayer 是 AVPlayer 的子类,用于按顺序播放多个项目。有关更多信息,请参阅其参考。您可以使用
AVComposition
在运行时从需要播放的两个(或 N 个)视频中合成一个视频。请注意,这仅适用于本地存储的视频,不适用于远程(流式传输或渐进式下载)。然后使用AVPlayer
进行播放。Three options:
You may use
MPMoviePlayerController
and start the playback of the 2nd (Nth) item after the previous is complete. This however will introduce a small gap between the videos cause by identification and pre buffering of the content.You may use
AVQueuePlayer
; AVQueuePlayer is a subclass of AVPlayer you use to play a number of items in sequence. See its reference for more.You may use
AVComposition
for at runtime composing one video out of the two (or N) you need to play back. Note, this works only on locally stored videos and not on remote (streaming or progressive download). Then useAVPlayer
for the playback.这是不可能的。如果视频资源位于本地文件系统中,请考虑 AVComposition。
It's not possible. If the video assets are in local file system, consider AVComposition.