mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add Player play and pause convenience methods
PiperOrigin-RevId: 283744017
This commit is contained in:
parent
e54b493bbf
commit
b7666df2b3
3 changed files with 26 additions and 7 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
* Make media session connector dispatch ACTION_SET_CAPTIONING_ENABLED.
|
* Make media session connector dispatch ACTION_SET_CAPTIONING_ENABLED.
|
||||||
* Add support for position and overlapping start/end times in SSA/ASS subtitles
|
* Add support for position and overlapping start/end times in SSA/ASS subtitles
|
||||||
([#6320](https://github.com/google/ExoPlayer/issues/6320)).
|
([#6320](https://github.com/google/ExoPlayer/issues/6320)).
|
||||||
|
* Add `play` and `pause` methods to `Player`.
|
||||||
* Upgrade Truth dependency from 0.44 to 1.0.
|
* Upgrade Truth dependency from 0.44 to 1.0.
|
||||||
|
|
||||||
### 2.11.0 (not yet released) ###
|
### 2.11.0 (not yet released) ###
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,16 @@ public abstract class BasePlayer implements Player {
|
||||||
window = new Timeline.Window();
|
window = new Timeline.Window();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void play() {
|
||||||
|
setPlayWhenReady(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void pause() {
|
||||||
|
setPlayWhenReady(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isPlaying() {
|
public final boolean isPlaying() {
|
||||||
return getPlaybackState() == Player.STATE_READY
|
return getPlaybackState() == Player.STATE_READY
|
||||||
|
|
|
||||||
|
|
@ -725,11 +725,19 @@ public interface Player {
|
||||||
@Nullable
|
@Nullable
|
||||||
ExoPlaybackException getPlaybackError();
|
ExoPlaybackException getPlaybackError();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes playback as soon as {@link #getPlaybackState()} == {@link #STATE_READY}. Equivalent to
|
||||||
|
* {@code setPlayWhenReady(true)}.
|
||||||
|
*/
|
||||||
|
void play();
|
||||||
|
|
||||||
|
/** Pauses playback. Equivalent to {@code setPlayWhenReady(false)}. */
|
||||||
|
void pause();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether playback should proceed when {@link #getPlaybackState()} == {@link #STATE_READY}.
|
* Sets whether playback should proceed when {@link #getPlaybackState()} == {@link #STATE_READY}.
|
||||||
* <p>
|
*
|
||||||
* If the player is already in the ready state then this method can be used to pause and resume
|
* <p>If the player is already in the ready state then this method pauses and resumes playback.
|
||||||
* playback.
|
|
||||||
*
|
*
|
||||||
* @param playWhenReady Whether playback should proceed when ready.
|
* @param playWhenReady Whether playback should proceed when ready.
|
||||||
*/
|
*/
|
||||||
|
|
@ -857,8 +865,8 @@ public interface Player {
|
||||||
PlaybackParameters getPlaybackParameters();
|
PlaybackParameters getPlaybackParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops playback without resetting the player. Use {@code setPlayWhenReady(false)} rather than
|
* Stops playback without resetting the player. Use {@link #pause()} rather than this method if
|
||||||
* this method if the intention is to pause playback.
|
* the intention is to pause playback.
|
||||||
*
|
*
|
||||||
* <p>Calling this method will cause the playback state to transition to {@link #STATE_IDLE}. The
|
* <p>Calling this method will cause the playback state to transition to {@link #STATE_IDLE}. The
|
||||||
* player instance can still be used, and {@link #release()} must still be called on the player if
|
* player instance can still be used, and {@link #release()} must still be called on the player if
|
||||||
|
|
@ -869,8 +877,8 @@ public interface Player {
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops playback and optionally resets the player. Use {@code setPlayWhenReady(false)} rather
|
* Stops playback and optionally resets the player. Use {@link #pause()} rather than this method
|
||||||
* than this method if the intention is to pause playback.
|
* if the intention is to pause playback.
|
||||||
*
|
*
|
||||||
* <p>Calling this method will cause the playback state to transition to {@link #STATE_IDLE}. The
|
* <p>Calling this method will cause the playback state to transition to {@link #STATE_IDLE}. The
|
||||||
* player instance can still be used, and {@link #release()} must still be called on the player if
|
* player instance can still be used, and {@link #release()} must still be called on the player if
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue