mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00:00
Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
(cherry picked from commit d49a16e094)
This commit is contained in:
parent
dd462e8cdb
commit
d41eedecb4
1 changed files with 7 additions and 0 deletions
|
|
@ -980,6 +980,9 @@ public class PlayerControlView extends FrameLayout {
|
|||
((ImageView) playPauseButton)
|
||||
.setImageDrawable(getDrawable(getContext(), resources, drawableRes));
|
||||
playPauseButton.setContentDescription(resources.getString(stringRes));
|
||||
|
||||
boolean enablePlayPause = shouldEnablePlayPauseButton();
|
||||
updateButton(enablePlayPause, playPauseButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1497,6 +1500,10 @@ public class PlayerControlView extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldEnablePlayPauseButton() {
|
||||
return player != null && !player.getCurrentTimeline().isEmpty();
|
||||
}
|
||||
|
||||
private boolean shouldShowPauseButton() {
|
||||
return player != null
|
||||
&& player.getPlaybackState() != Player.STATE_ENDED
|
||||
|
|
|
|||
Loading…
Reference in a new issue