remove check of media type

This commit is contained in:
Max Bechtold 2019-12-30 12:39:59 +01:00
parent 3e610c85b9
commit 3fa210c414
1 changed files with 10 additions and 12 deletions

View File

@ -668,19 +668,17 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
*/
private void setVolumeSync(float volumeLeft, float volumeRight) {
playerLock.lock();
if (media != null && EnumSet.of(MediaType.AUDIO, MediaType.VIDEO).contains(media.getMediaType())) {
Playable playable = getPlayable();
if (playable instanceof FeedMedia) {
FeedMedia feedMedia = (FeedMedia) playable;
FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences();
VolumeAdaptionSetting volumeAdaptionSetting = preferences.getVolumeAdaptionSetting();
float adaptionFactor = volumeAdaptionSetting.getAdaptionFactor();
volumeLeft *= adaptionFactor;
volumeRight *= adaptionFactor;
}
mediaPlayer.setVolume(volumeLeft, volumeRight);
Log.d(TAG, "Media player volume was set to " + volumeLeft + " " + volumeRight);
Playable playable = getPlayable();
if (playable instanceof FeedMedia) {
FeedMedia feedMedia = (FeedMedia) playable;
FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences();
VolumeAdaptionSetting volumeAdaptionSetting = preferences.getVolumeAdaptionSetting();
float adaptionFactor = volumeAdaptionSetting.getAdaptionFactor();
volumeLeft *= adaptionFactor;
volumeRight *= adaptionFactor;
}
mediaPlayer.setVolume(volumeLeft, volumeRight);
Log.d(TAG, "Media player volume was set to " + volumeLeft + " " + volumeRight);
playerLock.unlock();
}