AVPlayer seeToTime:循环短视频时性能不佳

发布于 2024-12-08 14:27:44 字数 630 浏览 1 评论 0原文

这是我的第一个问题,但我已经阅读 StackOverflow 多年了。 问题是我必须按特定顺序连接一组视频(MP4),并且最后一个视频必须连续循环。好的,让我们尝试一下 AVFoundation

我已经定义了所有元素,例如 AVCompositionAVURLAssetAVPlayerItem。然后我构建 AVPlayerAVPlayerLayer。一切都很好,视频按正确的顺序播放,但是......(问题来了)

当 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苦笑流年记忆 2024-12-15 14:27:44

绝对愚蠢,

朋友们,在制作视频处理应用程序时,请确保视频没有烦人的黑框。这是所有问题的根源。 [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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文