mirror of
https://github.com/androidx/media.git
synced 2025-04-29 14:26:50 +08:00
Add ExoPlayer.isScrubbingModeEnabled
This helps integration with `PlayerControlView` in a follow-up change, where we need to reliably know if scrubbing mode is still enabled (in case someone else disables it after we enable it). PiperOrigin-RevId: 750913644
This commit is contained in:
parent
d9a92e2586
commit
4189a7c8bd
@ -1485,6 +1485,14 @@ public interface ExoPlayer extends Player {
|
||||
@UnstableApi
|
||||
void setScrubbingModeEnabled(boolean scrubbingModeEnabled);
|
||||
|
||||
/**
|
||||
* Returns whether the player is optimized for scrubbing (many frequent seeks).
|
||||
*
|
||||
* <p>See {@link #setScrubbingModeEnabled(boolean)}.
|
||||
*/
|
||||
@UnstableApi
|
||||
boolean isScrubbingModeEnabled();
|
||||
|
||||
/**
|
||||
* Sets the parameters that control behavior in {@linkplain #setScrubbingModeEnabled scrubbing
|
||||
* mode}.
|
||||
|
@ -1611,6 +1611,12 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
maybeUpdatePlaybackSuppressionReason();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrubbingModeEnabled() {
|
||||
verifyApplicationThread();
|
||||
return scrubbingModeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrubbingModeParameters(ScrubbingModeParameters scrubbingModeParameters) {
|
||||
verifyApplicationThread();
|
||||
|
@ -628,6 +628,12 @@ public class SimpleExoPlayer extends BasePlayer implements ExoPlayer {
|
||||
player.setScrubbingModeEnabled(scrubbingModeEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrubbingModeEnabled() {
|
||||
blockUntilConstructorFinished();
|
||||
return player.isScrubbingModeEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrubbingModeParameters(ScrubbingModeParameters scrubbingModeParameters) {
|
||||
blockUntilConstructorFinished();
|
||||
|
@ -63,6 +63,21 @@ import org.mockito.InOrder;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public final class ExoPlayerScrubbingTest {
|
||||
|
||||
@Test
|
||||
public void scrubbingMode_getterWorks() throws Exception {
|
||||
ExoPlayer player =
|
||||
new TestExoPlayerBuilder(ApplicationProvider.getApplicationContext()).build();
|
||||
player.setMediaSource(new FakeMediaSource());
|
||||
player.prepare();
|
||||
|
||||
assertThat(player.isScrubbingModeEnabled()).isFalse();
|
||||
player.setScrubbingModeEnabled(true);
|
||||
assertThat(player.isScrubbingModeEnabled()).isTrue();
|
||||
player.setScrubbingModeEnabled(false);
|
||||
assertThat(player.isScrubbingModeEnabled()).isFalse();
|
||||
player.release();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scrubbingMode_suppressesPlayback() throws Exception {
|
||||
ExoPlayer player =
|
||||
|
@ -221,6 +221,11 @@ public class StubExoPlayer extends StubPlayer implements ExoPlayer {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrubbingModeEnabled() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrubbingModeParameters(ScrubbingModeParameters scrubbingModeParameters) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user