I need to loop my videoMaterial and I don't know how to make it happen in my code.
I have included an image of my videoMaterial code.
Any help making this happen with be greatly appreciated.
Thank you,
Christopher
I need to loop my videoMaterial and I don't know how to make it happen in my code.
I have included an image of my videoMaterial code.
Any help making this happen with be greatly appreciated.
Thank you,
Christopher
Hi there! I suggest trying AVQueuePlayer and AVPlayerLooper for this.
Create an AVPlayerItem from your video URL, and then create a single-item array that contains the new AVPlayerItem
. Then, use that array to create an AVQueuePlayer
, and use that AVQueuePlayer
to create an AVPlayerLooper
.
Next, pass your AVQueuePlayer
to the VideoMaterial
initializer (it's an AVPlayer
subclass, so you can use the same initializer you do above). When you play the AVQueuePlayer
, it should loop playback repeatedly because of the AVPlayerLooper
.