StreamingKit icon indicating copy to clipboard operation
StreamingKit copied to clipboard

STKAudioPlayer.m: processSeekToTime sometimes sets seekTime to very large numbers

Open MatthewMaker opened this issue 10 years ago • 5 comments

at line 1547 of STKAudioPlayer.m, delta is sometimes negative, which leads to the player grossly overreporting the track's progress after a seek. The audio itself is still correct, but the reported time is often larger than the length of the track.

I'm not sure how it gets the incorrect value, but for our purposes, wrapping those lines in an if (delta > 0) { } clause corrects the issue.

It seems to particularly happen when the queued items have recently been changed, and the playback is buffering.

We are playing from a list of sources that the user can move back and forth between freely. We are performing the seek in didStartPlayingQueueItemId, to return to a remembered spot in the audio for that item.

Anyone know what's happening here, and whether it represents a bug in seeking in StreamingKit, a misunderstanding on our part of how to use it, or both/neither?

MatthewMaker avatar Aug 18 '15 20:08 MatthewMaker

Line 1547 of STKAudioPlayer.m - https://github.com/tumtumtum/StreamingKit/blob/master/StreamingKit/StreamingKit/STKAudioPlayer.m#L1547 - is a return statement inside a read < 0 if clause - no 'delta' around. Do you have the right file/line number or the latest version? There is a delta > 0 trap at https://github.com/tumtumtum/StreamingKit/blob/master/StreamingKit/StreamingKit/STKAudioPlayer.m#L2918

richardgroves avatar Aug 19 '15 10:08 richardgroves

@richardgroves My apologies, I should have said we are using the 0.1.25 release. The line I meant to point to is here: https://github.com/tumtumtum/StreamingKit/blob/000930a29587e42f2a01b5bce810f72e8e1e435b/StreamingKit/StreamingKit/STKAudioPlayer.m#L1450 . (I must have gotten that other line# from a non-github editor.)

MatthewMaker avatar Aug 20 '15 17:08 MatthewMaker

I added a trap https://github.com/Monstrous/StreamingKit/commit/311d2aabf9c61837b1b44597c80ab69c602040a1 that seems to correct this, but I'm curious what causes it.

MatthewMaker avatar Aug 20 '15 17:08 MatthewMaker

Surrounding that line fixes the issue for me as well. @MatthewMaker, did you happen to make a pull request for this already?

cjwhitsitt avatar May 10 '16 21:05 cjwhitsitt

same issue. the progress wrong after seek. I play local file.

veila avatar Feb 05 '18 09:02 veila