Salman Khakwani
Salman Khakwani

Reputation: 6714

How do I get current playing time and total play time in AVQueuePlayer?

Is it possible get playing time and total play time in AVQueuePlayer? If yes, how can I do this?

What i have tried so far :

CMTime currentTime = [self.myAVQueuePlayerObject currentTime];

But it is returning the currently played duration of the currentItem located in the Queue.

What i want to achieve ?

I want to get the currentTime Played with respect to all the items present in the AVQueue Player , how can i do that ?

Any Help is Highly Appreciated.

Upvotes: 0

Views: 950

Answers (1)

Raptor
Raptor

Reputation: 54212

Since AVQueuePlayer is inherited by AVPlayer...

Playing Time:

float currentTime = queuePlayer.currentTime;

Total Play Time:

Use KVO to observe the events of AVQueuePlayer (similar to this), and calculate the total play time of your queue yourself.

For total time of current playing song, you can use:

float duration = queuePlayer.duration;

Upvotes: 1

Related Questions