-
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
Play/pause should have different behavior at end of video #3689
Comments
The current behaviour of the PlaybackControlView works as intended as it reflects the state of the player (playWhenReady=true and position at the very end). Instead of providing your own dispatcher you could wait for the state Player.STATE_ENDED with a Player.EventListener and then do
Now the player state is playWhenReady=false an position=0 and the UI reflects this. When the user taps play it starts from the beginning. Note, that the first frame of the video will be displayed at this stage. |
Thank you. I understand your solution and see that it works, but I really feel that for many apps having the controls reflect the player state doesn't provide the best experience. To get around the issue of jumping to the first frame, I think I can do something like this for my own apps at least:
(I realize this is an ugly hack). |
@marcbaechinger - Do we have assets for a replay button already? |
Nope. I checked with the Material Design Icons and there is one when I search for 'replay'. |
It could also be valid (and possibly nicer) to use the play button for the replay case, rather than using the replay asset. |
- In IDLE, the button will now call a preparer. This allows removal of the separate retry button from the demo app. - In ENDED, the button will seek back to the default position and play. - Behavior is made consistent with LeanbackPlayerAdapter. Issue: #3689 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=182506855
This is fixed in the |
(I'm not sure if this qualifies as a bug or a feature request)
I'm running the sample app, and at the end of the video the pause/play button stops having any effect. The icon changes when tapped, but nothing else happens.
On YouTube, reaching the end of a video changes the button from play to a third state - replay. Pressing it seeks to the beginning and starts playback again. I think that makes for a far better user experience.
I've tried to accomplish the same thing with a PlaybackControlView.ControlDispatcher that checks the current time in dispatchSetPlayWhenReady() and if it's identical to the duration of the video, calls player.seekTo(0) then player.setPlayWhenReady(true) - this does jump back to the beginning of the video but a second press is required to actually start playback. What am I missing?
The text was updated successfully, but these errors were encountered: