-
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
DynamicConcatenatingMediaSource with no auto play #3773
Comments
@ojw28 you've fielded this question before, I was hoping you might have some advice, thanks in advance! |
You could listen to Be aware that this solution means that the player already switched to the next track but does not continue playing. |
Thanks @tonihei, ya I do know that trick, but unfortunately I need it to stop on the current one. For now I will just be using a single media source, and supplying my own "next" button, and my own auto-play, instead of using the built in ones. |
There is actually another option which allows you to pause playback at the end of the current item. We recently added the option to send messages at specified playback positions. This feature is currently on the dev-branch but will be part of the next release. With that, you can send a message at the end of each playlist item and pause the player in this message. By default, messages are sent on the playback thread which helps to ensure that the pause command reaches the playback loop in time before the transition to the next playlist item. Sending the message should look like this:
Setting However, there are two caveats to this approach:
|
Marked as bug because of the possibility of getting listener callbacks which are not on the thread which created the player. |
We decided that we actually can't support access to the player from multiple threads because there is no way to fully synchronize this access from outside. This essentially means that the solution I proposed above is not valid. Nevertheless, you can try to set a Handler to the message which ensures it's executed on your application thread:
This prevents any synchronization issues and problems caused by getting listener callbacks on the wrong thread. However, it now depends on the system how fast it can deliver this message back to the player. In the majority of cases, this will work (even without the offset I added above), but it's not 100% guaranteed. |
Thanks for the update - that messaging system sounds very interesting - I can already think of one other thing I would use it for. I'll take a look at that in the next release - thanks again! |
…ad of allowing it. Even if a developer synchronizes every method, thread safety is still not guaranteed because the internal callback methods can't be synced from outside. Issue:#3773 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184122072
Issue description
I am wondering if there's a way to have a DynamicConcatenatingMediaSource which does not automatically start the next track.
I've followed the conversation on #2810. In which the suggestion was to simply not use a ConcatenatingMediaSource. However, in my use case, the user can toggle whether they want to "auto play", and I always want to be able to show the "next track" button. This happens to be the same behavior as Youtube.
The only other way I think it could be accomplished, is if I could smoothly (without affecting playback) swap my DynamicConcatenatingMediaSource for a singular MediaSource, and still be able to show the "next track" button as enabled. Is that possible?
Version of ExoPlayer being used
2.6.1
The text was updated successfully, but these errors were encountered: