user2311554
user2311554

Reputation: 3

AVQueuePlayer stops playing when I navigate to previous view

I have used AVQueuePlayer several times and the default behaviour is to continue playing when you change view, but in my case when I navigate to the previous view where I came from by segue, the player stops. I put a breakpoint after dealloc to see if the AVQueuePlayer is released and from what I can see it's not deallocated (I have a strong reference to it using property). Please help!!!

I am streaming audio using several links from a server, not playing local files. I created the url, used the url to make AVPlayerItems, and added the player items into array, I used this array to initiate the AVQueuePlayer. I used GCD to make sure my array is completely ready before I play the AVQueuePlayer.

As soon I click on back button it stops. I am pulling out my hair

Upvotes: 0

Views: 212

Answers (1)

Marko Hlebar
Marko Hlebar

Reputation: 1973

Create a singleton class that provides an interface to the AVQueuePlayer. That way you will be sure that it's alive even when you pop your view controllers.

Upvotes: 0

Related Questions