Commit b755df13 by ibaker Committed by Oliver Woodman

Update PlayerWrapper methods to return void where possible

Suggested during the review of https://github.com/google/ExoPlayer/commit/437d1b6e9ae1e085583b3ab8e8d686d1eea32b65

This keeps the Runnable -> Callable<Boolean> conversion encapsulated
inside SessionPlayerConnector which makes it clearer why it's needed.

PiperOrigin-RevId: 321553744
parent c0204bfd
......@@ -305,11 +305,10 @@ import java.util.List;
}
}
public boolean setAudioAttributes(AudioAttributesCompat audioAttributes) {
public void setAudioAttributes(AudioAttributesCompat audioAttributes) {
Player.AudioComponent audioComponent = Assertions.checkStateNotNull(player.getAudioComponent());
audioComponent.setAudioAttributes(
Utils.getAudioAttributes(audioAttributes), /* handleAudioFocus= */ true);
return true;
}
public AudioAttributesCompat getAudioAttributes() {
......@@ -318,9 +317,8 @@ import java.util.List;
audioComponent != null ? audioComponent.getAudioAttributes() : AudioAttributes.DEFAULT);
}
public boolean setPlaybackSpeed(float playbackSpeed) {
public void setPlaybackSpeed(float playbackSpeed) {
player.setPlaybackSpeed(playbackSpeed);
return true;
}
public float getPlaybackSpeed() {
......
......@@ -178,14 +178,20 @@ public final class SessionPlayerConnector extends SessionPlayer {
Assertions.checkArgument(playbackSpeed > 0f);
return playerCommandQueue.addCommand(
PlayerCommandQueue.COMMAND_CODE_PLAYER_SET_SPEED,
/* command= */ () -> player.setPlaybackSpeed(playbackSpeed));
/* command= */ () -> {
player.setPlaybackSpeed(playbackSpeed);
return true;
});
}
@Override
public ListenableFuture<PlayerResult> setAudioAttributes(AudioAttributesCompat attr) {
return playerCommandQueue.addCommand(
PlayerCommandQueue.COMMAND_CODE_PLAYER_SET_AUDIO_ATTRIBUTES,
/* command= */ () -> player.setAudioAttributes(Assertions.checkNotNull(attr)));
/* command= */ () -> {
player.setAudioAttributes(Assertions.checkNotNull(attr));
return true;
});
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment