-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect loop/repeat but not media source change with ConcatenatingMediaSource #4898
Comments
The easiest way to distinguish between these two cases is to check if Note that this assumes all your playlist items have just one period. That should be true unless you are using multi-period DASH streams. In this case, you also need to check if the current period is the first in the window to know whether the item is repeating. |
Just to drop our 2¢, we're working with local files being added to a In order to detect track transitions within playlist, we register a Everytime currently playing track changes to a different one, or starts again in case of a loop, that method gets invoked by ExoPlayer. Reported index will be the same as the last invocation in case of a loop, otherwise will be a different one in case of a new playlist item. HTH |
@BrainCrumbz You really should be using |
Thanks for pointing that out. Will have to double check this. At the moment we need to be notified also when playing track changes due to a seek operation, and with this method we can collect both scenarios in the same call. Don't recall whether |
@tonihei thank you for the advice, now I can track the window indices on discontinuity and detect if we came to the initial window using that. |
Glad to be of help :) |
Yeah, so after repeating some tests we got back some more memories and thoughts. When playing flows naturally from a playlist item to the next, the two events are basically the same for us. It's enough to detect the
Things are different in other scenarios though. When users skips to another playlist item:
We could detect Another scenario with a similar situation is when playing actually starts, after the very first playlist items have been added and we seek to 0 & play to actually start:
In this case there's even a longer interval between the two events. |
That's working as intended. The DISCONTINUITY_REASON_SEEK is sent immediately after calling seek. The seekProcessed callback indicates that the internal player acknowledged the seek and all necessary state changes have been made. That's why you see that a little bit later. DISCONTINUITY_REASON_SEEK_ADJUSTMENT is only used if the player needed to adjust the requested seek position. I guess that's irrelevant for most people. In any case, I would argue that
Note that |
Thanks for your example. ignoring loops for the moment, upon a Looking at reported window index upon the event, that is already up-to-date so maybe that's the case. But on the other hand, the actual seek is completed only upon |
Yes, you can consider the previous item as obsolete at this point. Any playlist updates will be queued on the internal playback thread too and thus will be handled after the seek. |
Sorry to drag this further, but by any chance has onTracksChanged event behaviour changed between 2.8.2 and 2.9.0? |
@BrainCrumbz |
Thanks for the real quick response. Well, it looks like we'll have to change our track change detection logic, move away from |
For what it's worth, I think the time you get by listening to |
@tonihei - Does this still need additional documentation, now that we have |
Yes, |
Hello,
I am using multiple media sources to feed my
ConcatenatingMediaSource
and this media source is in constant repeat mode. As far as I have searched, usingonPositionDiscontinuity
you can detect repeats with it and also you can detect the media source switches ofConcatenatingMediaSource
with that as well. However the argumentreason
in that method is0
for both cases. So am I missing something or is there another way to get a callback when theConcatenatingMediaSource
repeats?Thanks!
The text was updated successfully, but these errors were encountered: