0

How to play Videos one after another on a Button Click using AVPlayer.

Bharu
  • 159
  • 1
  • 3
  • 13

1 Answers1

1

You can use AVQueuePlayer to play multiple videos or play list something like,

 AVPlayerItem *itemOne = [AVPlayerItem playerItemWithURL: url1];
AVPlayerItem *itemTwo = [AVPlayerItem playerItemWithURL: url2];

AVQueuePlayer *queuePlayer = [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObjects:itemOne, itemTwo, nil]];

[queuePlayer play];

You can add item like while playing,

 [queuePlayer insertItem:itemThree afterItem:itemOne];

You can refer Apple documentation that i have mentioned in link for more methods and details.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75