@@ -990,7 +990,7 @@ private void updateInternalStateAndNotifyIfChanged() {
990
990
? getCurrentTimeline ().getPeriod (oldWindowIndex , period , /* setIds= */ true ).uid
991
991
: null ;
992
992
updatePlayerStateAndNotifyIfChanged (/* resultCallback= */ null );
993
- updateVolumeAndNotifyIfChanged ();
993
+ updateDeviceVolumeAndNotifyIfChanged ();
994
994
updateRepeatModeAndNotifyIfChanged (/* resultCallback= */ null );
995
995
updateVolumeAndNotifyIfChanged (/* resultCallback= */ null );
996
996
updatePlaybackRateAndNotifyIfChanged (/* resultCallback= */ null );
@@ -1101,21 +1101,13 @@ private void updatePlaybackRateAndNotifyIfChanged(@Nullable ResultCallback<?> re
1101
1101
}
1102
1102
1103
1103
@ RequiresNonNull ("castSession" )
1104
- private void updateVolumeAndNotifyIfChanged () {
1104
+ private void updateDeviceVolumeAndNotifyIfChanged () {
1105
1105
if (castSession != null ) {
1106
1106
int deviceVolume = VOLUME_RANGE .clamp ((int ) Math .round (castSession .getVolume () * MAX_VOLUME ));
1107
1107
setDeviceVolumeAndNotifyIfChanged (deviceVolume , castSession .isMute ());
1108
1108
}
1109
1109
}
1110
1110
1111
- @ RequiresNonNull ("remoteMediaClient" )
1112
- private void updateRepeatModeAndNotifyIfChanged (@ Nullable ResultCallback <?> resultCallback ) {
1113
- if (repeatMode .acceptsUpdate (resultCallback )) {
1114
- setRepeatModeAndNotifyIfChanged (fetchRepeatMode (remoteMediaClient ));
1115
- repeatMode .clearPendingResultCallback ();
1116
- }
1117
- }
1118
-
1119
1111
@ RequiresNonNull ("remoteMediaClient" )
1120
1112
private void updateVolumeAndNotifyIfChanged (@ Nullable ResultCallback <?> resultCallback ) {
1121
1113
if (volume .acceptsUpdate (resultCallback )) {
@@ -1124,6 +1116,14 @@ private void updateVolumeAndNotifyIfChanged(@Nullable ResultCallback<?> resultCa
1124
1116
}
1125
1117
}
1126
1118
1119
+ @ RequiresNonNull ("remoteMediaClient" )
1120
+ private void updateRepeatModeAndNotifyIfChanged (@ Nullable ResultCallback <?> resultCallback ) {
1121
+ if (repeatMode .acceptsUpdate (resultCallback )) {
1122
+ setRepeatModeAndNotifyIfChanged (fetchRepeatMode (remoteMediaClient ));
1123
+ repeatMode .clearPendingResultCallback ();
1124
+ }
1125
+ }
1126
+
1127
1127
/**
1128
1128
* Updates the timeline and notifies {@link Player.Listener event listeners} if required.
1129
1129
*
@@ -1527,7 +1527,6 @@ private static int fetchPlaybackState(RemoteMediaClient remoteMediaClient) {
1527
1527
private static float fetchVolume (RemoteMediaClient remoteMediaClient ) {
1528
1528
MediaStatus mediaStatus = remoteMediaClient .getMediaStatus ();
1529
1529
if (mediaStatus == null ) {
1530
- // No media session active, yet.
1531
1530
return 1f ;
1532
1531
}
1533
1532
return (float ) mediaStatus .getStreamVolume ();
@@ -1797,7 +1796,6 @@ public DeviceInfo fetchDeviceInfo() {
1797
1796
// There's only one remote routing controller. It's safe to assume it's the Cast routing
1798
1797
// controller.
1799
1798
RoutingController remoteController = controllers .get (1 );
1800
- // TODO b/364580007 - Populate min volume information.
1801
1799
return new DeviceInfo .Builder (DeviceInfo .PLAYBACK_TYPE_REMOTE )
1802
1800
.setMaxVolume (MAX_VOLUME )
1803
1801
.setRoutingControllerId (remoteController .getId ())
@@ -1836,7 +1834,7 @@ private final class CastListener extends Cast.Listener {
1836
1834
1837
1835
@ Override
1838
1836
public void onVolumeChanged () {
1839
- updateVolumeAndNotifyIfChanged ();
1837
+ updateDeviceVolumeAndNotifyIfChanged ();
1840
1838
listeners .flushEvents ();
1841
1839
}
1842
1840
}
0 commit comments