Rename audioVolume
parameter to volume
The new name is consistent with the corresponding parameters to `onVolumeChanged`, `setDeviceVolume` and `onDeviceVolumeChanged`. PiperOrigin-RevId: 395705288
This commit is contained in:
parent
1bef1a2b38
commit
0c4bb23dd3
@ -678,7 +678,7 @@ public final class CastPlayer extends BasePlayer {
|
|||||||
|
|
||||||
/** This method is not supported and does nothing. */
|
/** This method is not supported and does nothing. */
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float audioVolume) {}
|
public void setVolume(float volume) {}
|
||||||
|
|
||||||
/** This method is not supported and returns 1. */
|
/** This method is not supported and returns 1. */
|
||||||
@Override
|
@Override
|
||||||
|
@ -525,8 +525,8 @@ public class ForwardingPlayer implements Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float audioVolume) {
|
public void setVolume(float volume) {
|
||||||
player.setVolume(audioVolume);
|
player.setVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2210,9 +2210,9 @@ public interface Player {
|
|||||||
/**
|
/**
|
||||||
* Sets the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
|
* Sets the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
|
||||||
*
|
*
|
||||||
* @param audioVolume Linear output gain to apply to all audio channels.
|
* @param volume Linear output gain to apply to all audio channels.
|
||||||
*/
|
*/
|
||||||
void setVolume(@FloatRange(from = 0) float audioVolume);
|
void setVolume(@FloatRange(from = 0) float volume);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
|
* Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
|
||||||
|
@ -1010,7 +1010,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
|
|
||||||
/** This method is not supported and does nothing. */
|
/** This method is not supported and does nothing. */
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float audioVolume) {}
|
public void setVolume(float volume) {}
|
||||||
|
|
||||||
/** This method is not supported and returns 1. */
|
/** This method is not supported and returns 1. */
|
||||||
@Override
|
@Override
|
||||||
|
@ -452,7 +452,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
@Nullable private DecoderCounters audioDecoderCounters;
|
@Nullable private DecoderCounters audioDecoderCounters;
|
||||||
private int audioSessionId;
|
private int audioSessionId;
|
||||||
private AudioAttributes audioAttributes;
|
private AudioAttributes audioAttributes;
|
||||||
private float audioVolume;
|
private float volume;
|
||||||
private boolean skipSilenceEnabled;
|
private boolean skipSilenceEnabled;
|
||||||
private List<Cue> currentCues;
|
private List<Cue> currentCues;
|
||||||
@Nullable private VideoFrameMetadataListener videoFrameMetadataListener;
|
@Nullable private VideoFrameMetadataListener videoFrameMetadataListener;
|
||||||
@ -517,7 +517,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
componentListener);
|
componentListener);
|
||||||
|
|
||||||
// Set initial values.
|
// Set initial values.
|
||||||
audioVolume = 1;
|
volume = 1;
|
||||||
if (Util.SDK_INT < 21) {
|
if (Util.SDK_INT < 21) {
|
||||||
audioSessionId = initializeKeepSessionIdAudioTrack(C.AUDIO_SESSION_ID_UNSET);
|
audioSessionId = initializeKeepSessionIdAudioTrack(C.AUDIO_SESSION_ID_UNSET);
|
||||||
} else {
|
} else {
|
||||||
@ -870,24 +870,24 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float audioVolume) {
|
public void setVolume(float volume) {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
audioVolume = Util.constrainValue(audioVolume, /* min= */ 0, /* max= */ 1);
|
volume = Util.constrainValue(volume, /* min= */ 0, /* max= */ 1);
|
||||||
if (this.audioVolume == audioVolume) {
|
if (this.volume == volume) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.audioVolume = audioVolume;
|
this.volume = volume;
|
||||||
sendVolumeToRenderers();
|
sendVolumeToRenderers();
|
||||||
analyticsCollector.onVolumeChanged(audioVolume);
|
analyticsCollector.onVolumeChanged(volume);
|
||||||
// TODO(internal b/187152483): Events should be dispatched via ListenerSet
|
// TODO(internal b/187152483): Events should be dispatched via ListenerSet
|
||||||
for (Listener listener : listeners) {
|
for (Listener listener : listeners) {
|
||||||
listener.onVolumeChanged(audioVolume);
|
listener.onVolumeChanged(volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getVolume() {
|
public float getVolume() {
|
||||||
return audioVolume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1772,7 +1772,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendVolumeToRenderers() {
|
private void sendVolumeToRenderers() {
|
||||||
float scaledVolume = audioVolume * audioFocusManager.getVolumeMultiplier();
|
float scaledVolume = volume * audioFocusManager.getVolumeMultiplier();
|
||||||
sendRendererMessage(TRACK_TYPE_AUDIO, MSG_SET_VOLUME, scaledVolume);
|
sendRendererMessage(TRACK_TYPE_AUDIO, MSG_SET_VOLUME, scaledVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float audioVolume) {
|
public void setVolume(float volume) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user