StreamingKit icon indicating copy to clipboard operation
StreamingKit copied to clipboard

clearQueue is called twice after calling playURL

Open stevepetersen opened this issue 8 years ago • 2 comments

I have noticed that when I start the player via playURL: and immediately add content with queueURL, the player will sometimes clear the content in the queue unexpectedly.

I have tracked this down to the fact that the [self clearQueue] method is called twice - once synchronously within the setDataSource:withQueueItemId: method (which is expected because it is called from within playURL:) and once again from within [self setCurrentlyReadingEntry: andStartPlaying:], which by default clears the queue again. I suspect that this second clearing of the queue is unintentional, and if I make the following code change, I get the expected behavior that the queue is not cleared after the initial time:

Change from

-(void) setCurrentlyReadingEntry:(STKQueueEntry*)entry andStartPlaying:(BOOL)startPlaying
{
    [self setCurrentlyReadingEntry:entry andStartPlaying:startPlaying clearQueue:YES];
}

to

-(void) setCurrentlyReadingEntry:(STKQueueEntry*)entry andStartPlaying:(BOOL)startPlaying
{
    [self setCurrentlyReadingEntry:entry andStartPlaying:startPlaying clearQueue:NO];
}

I suspect this is a bug. Thanks for taking a look at this.

stevepetersen avatar Jan 21 '17 00:01 stevepetersen

Hi, In this func is it playing twice ? Your code is fixed above ?

kristoff2016 avatar Jan 23 '17 01:01 kristoff2016

Hi - with the setCurrentlyReadingEntry in its first form above, the first queue item gets cleared before it can play completely which I believe is a bug. In the second form, which is what I believe is correct, the first queue item plays completely.

stevepetersen avatar Jan 23 '17 02:01 stevepetersen