mirror of
https://github.com/samsonjs/media.git
synced 2026-04-18 13:25:47 +00:00
Update PlayerWrapper methods to return void where possible
Suggested during the review of 437d1b6e9a
This keeps the Runnable -> Callable<Boolean> conversion encapsulated
inside SessionPlayerConnector which makes it clearer why it's needed.
PiperOrigin-RevId: 321553744
This commit is contained in:
parent
c0204bfdc4
commit
b755df1338
2 changed files with 10 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue