mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Add support for setting and getting volume for composition preview.
PiperOrigin-RevId: 641822822
This commit is contained in:
parent
7b1a0376ad
commit
6bb3af527a
2 changed files with 11 additions and 0 deletions
|
|
@ -248,6 +248,8 @@ public final class CompositionPlayer extends SimpleBasePlayer
|
|||
COMMAND_GET_CURRENT_MEDIA_ITEM,
|
||||
COMMAND_GET_TIMELINE,
|
||||
COMMAND_SET_VIDEO_SURFACE,
|
||||
COMMAND_GET_VOLUME,
|
||||
COMMAND_SET_VOLUME,
|
||||
COMMAND_RELEASE)
|
||||
.build();
|
||||
|
||||
|
|
@ -521,6 +523,13 @@ public final class CompositionPlayer extends SimpleBasePlayer
|
|||
return Futures.immediateVoidFuture();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenableFuture<?> handleSetVolume(float volume) {
|
||||
volume = Util.constrainValue(volume, /* min= */ 0, /* max= */ 1);
|
||||
finalAudioSink.setVolume(volume);
|
||||
return Futures.immediateVoidFuture();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenableFuture<?> handleSeek(int mediaItemIndex, long positionMs, int seekCommand) {
|
||||
CompositionPlayerInternal compositionPlayerInternal =
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ public class CompositionPlayerTest {
|
|||
Player.COMMAND_GET_CURRENT_MEDIA_ITEM,
|
||||
Player.COMMAND_GET_TIMELINE,
|
||||
Player.COMMAND_SET_VIDEO_SURFACE,
|
||||
Player.COMMAND_GET_VOLUME,
|
||||
Player.COMMAND_SET_VOLUME,
|
||||
Player.COMMAND_RELEASE);
|
||||
|
||||
player.release();
|
||||
|
|
|
|||
Loading…
Reference in a new issue