在AVQueuePlayer中重复AVPlayerItem [英] repeat AVPlayerItem in AVQueuePlayer
问题描述
我正在使用AVQueuePlayer播放我的视频列表。我想连续播放一个视频,除非我要求播放第二个视频。现在,Video1播放,当它结束时,要求播放我不喜欢的video2。
I am using AVQueuePlayer to play my list of videos. I want to play one video continuously unless I call for second video to play. Now, Video1 plays and when it ends, calls for video2 to play which I don't like.
其次,两个视频之间有延迟。有没有办法从1个视频平滑过渡到第2个?
Secondly, there is a delay in between two videos. Is there any way of smooth transition from 1 video to second one?
推荐答案
关于你的第一个问题:设置 AVQueuePlayer
的 actionAtItemEnd
属性为 AVPlayerActionAtItemEndNone
。然后注册 AVPlayerItemDidPlayToEndTimeNotification
并在处理此通知的函数内调用 [player seekToTime:kCMTimeZero]
,它会播放您当前的视频从一开始。
第二个问题:您也可以在上述功能中处理此案例。
Regarding your first question: Set the AVQueuePlayer
's actionAtItemEnd
property to AVPlayerActionAtItemEndNone
. Then register for AVPlayerItemDidPlayToEndTimeNotification
and inside the function that treats this notification call [player seekToTime:kCMTimeZero]
, which plays your current video from the beginning.
Second question: You could take care of this case inside the above function also.
这篇关于在AVQueuePlayer中重复AVPlayerItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!