AVPlayer seeToTime:循环短视频时性能不佳
这是我的第一个问题,但我已经阅读 StackOverflow 多年了。 问题是我必须按特定顺序连接一组视频(MP4),并且最后一个视频必须连续循环。好的,让我们尝试一下 AVFoundation
。
我已经定义了所有元素,例如 AVComposition
、AVURLAsset
和 AVPlayerItem
。然后我构建 AVPlayer
和 AVPlayerLayer
。一切都很好,视频按正确的顺序播放,但是......(问题来了)
当 AVPlayer 从一个视频转到下一个视频时,我可以注意到轻微的轻弹。我可以忽略这个,但是当 AVPlayer
到达 AVPlayerItem
的末尾,并且为 AVPlayerItemDidPlayToEndTimeNotification
调用选择器时,我使用eekToTime 来移动阅读头到正确的位置,然后再次播放。工作正常,但使用seekToTime 并再次播放时会重复播放精彩的影片。我不能允许这样的事情发生。
有谁知道如何连续重复 AVPlayerItem 上的最后一个资源而不需要轻拂?
谢谢大家。
this is my first question, but I've readed StackOverflow for years.
Well the thing is that I must concatenate a set of videos (MP4) in a particular order, and the last one must loop continuously. Okay, let's try AVFoundation
.
I've defined all the elements such as AVComposition
, AVURLAsset
and AVPlayerItem
. Then I build the AVPlayer
and the AVPlayerLayer
. Everything is okay and the videos are played in the correct order but... (and here comes the problem)
I can note a tiny flick when the AVPlayer passes from one video to the next one. I can ignore that one, but when AVPlayer
reaches AVPlayerItem
's end, and the selector is called for AVPlayerItemDidPlayToEndTimeNotification
, I use seekToTime to move the reading head to the correct and then play it again. Works fine, but a GREAT flick is repeated when using seekToTime and playing again. I cannot allow that.
Does anybody know how to repeat the last asset on AVPlayerItem continuously and without flicks?
Thank you all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绝对愚蠢,
朋友们,在制作视频处理应用程序时,请确保视频没有烦人的黑框。这是所有问题的根源。
[AVPlayereekToTime:]
工作完美。感谢您的时间和耐心
Absolutely stupid,
Friends, when making video manipulation apps be sure that the videos don't have annoying black frames. That was the root of all problems.
[AVPlayer seekToTime:]
works perfectly.Thanks for your time and patience