SimpleExoPlayer
public static interface Player.DeviceComponent
Player
.Modifier and Type | Method | Description |
---|---|---|
void |
addDeviceListener(DeviceListener listener) |
Adds a listener to receive device events.
|
void |
decreaseDeviceVolume() |
Decreases the volume of the device.
|
DeviceInfo |
getDeviceInfo() |
Gets the device information.
|
int |
getDeviceVolume() |
Gets the current volume of the device.
|
void |
increaseDeviceVolume() |
Increases the volume of the device.
|
boolean |
isDeviceMuted() |
Gets whether the device is muted or not.
|
void |
removeDeviceListener(DeviceListener listener) |
Removes a listener of device events.
|
void |
setDeviceMuted(boolean muted) |
Sets the mute state of the device.
|
void |
setDeviceVolume(int volume) |
Sets the volume of the device.
|
void addDeviceListener(DeviceListener listener)
void removeDeviceListener(DeviceListener listener)
DeviceInfo getDeviceInfo()
int getDeviceVolume()
For devices with local playback
, the volume
returned by this method varies according to the current stream type
. The
stream type is determined by AudioAttributes.usage
which can be converted to stream
type with Util.getStreamTypeForAudioUsage(int)
. The audio attributes can be set to
the player by calling Player.AudioComponent.setAudioAttributes(com.google.android.exoplayer2.audio.AudioAttributes, boolean)
.
For devices with remote playback
, the volume of
the remote device is returned.
boolean isDeviceMuted()
void setDeviceVolume(int volume)
volume
- The volume to set.void increaseDeviceVolume()
void decreaseDeviceVolume()
void setDeviceMuted(boolean muted)