Fix volume adaption while paused

This commit is contained in:
ByteHamster 2020-01-25 22:53:26 +01:00
parent 190b54ad70
commit e09fae22a2
1 changed files with 1 additions and 12 deletions

View File

@ -10,10 +10,8 @@ class PlaybackVolumeUpdater {
public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId,
VolumeAdaptionSetting volumeAdaptionSetting) { VolumeAdaptionSetting volumeAdaptionSetting) {
Playable playable = mediaPlayer.getPlayable(); Playable playable = mediaPlayer.getPlayable();
boolean isFeedMedia = playable instanceof FeedMedia;
boolean isPlayableLoaded = isPlayableLoaded(mediaPlayer.getPlayerStatus());
if (isFeedMedia && isPlayableLoaded) { if (playable instanceof FeedMedia) {
updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable);
} }
} }
@ -30,15 +28,6 @@ class PlaybackVolumeUpdater {
} }
} }
private static boolean isPlayableLoaded(PlayerStatus playerStatus) {
return playerStatus == PlayerStatus.PLAYING
|| playerStatus == PlayerStatus.PAUSED
|| playerStatus == PlayerStatus.SEEKING
|| playerStatus == PlayerStatus.PREPARING
|| playerStatus == PlayerStatus.PREPARED
|| playerStatus == PlayerStatus.INITIALIZING;
}
private void forceUpdateVolume(PlaybackServiceMediaPlayer mediaPlayer) { private void forceUpdateVolume(PlaybackServiceMediaPlayer mediaPlayer) {
mediaPlayer.pause(false, false); mediaPlayer.pause(false, false);
mediaPlayer.resume(); mediaPlayer.resume();