Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b7666df2
authored
Dec 04, 2019
by
olly
Committed by
Ian Baker
Dec 05, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add Player play and pause convenience methods
PiperOrigin-RevId: 283744017
parent
e54b493b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java
library/core/src/main/java/com/google/android/exoplayer2/Player.java
RELEASENOTES.md
View file @
b7666df2
...
...
@@ -24,6 +24,7 @@
*
Make media session connector dispatch ACTION_SET_CAPTIONING_ENABLED.
*
Add support for position and overlapping start/end times in SSA/ASS subtitles
(
[
#6320
](
https://github.com/google/ExoPlayer/issues/6320
)
).
*
Add
`play`
and
`pause`
methods to
`Player`
.
*
Upgrade Truth dependency from 0.44 to 1.0.
### 2.11.0 (not yet released) ###
...
...
library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java
View file @
b7666df2
...
...
@@ -28,6 +28,16 @@ public abstract class BasePlayer implements Player {
}
@Override
public
final
void
play
()
{
setPlayWhenReady
(
true
);
}
@Override
public
final
void
pause
()
{
setPlayWhenReady
(
false
);
}
@Override
public
final
boolean
isPlaying
()
{
return
getPlaybackState
()
==
Player
.
STATE_READY
&&
getPlayWhenReady
()
...
...
library/core/src/main/java/com/google/android/exoplayer2/Player.java
View file @
b7666df2
...
...
@@ -726,10 +726,18 @@ public interface Player {
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}.
* <p>
* If the player is already in the ready state then this method can be used to pause and resume
* playback.
*
* <p>If the player is already in the ready state then this method pauses and resumes playback.
*
* @param playWhenReady Whether playback should proceed when ready.
*/
...
...
@@ -857,8 +865,8 @@ public interface Player {
PlaybackParameters
getPlaybackParameters
();
/**
* Stops playback without resetting the player. Use {@
code setPlayWhenReady(false)} rather than
* th
is method if th
e intention is to pause playback.
* Stops playback without resetting the player. Use {@
link #pause()} rather than this method if
* the intention is to pause playback.
*
* <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
...
...
@@ -869,8 +877,8 @@ public interface Player {
void
stop
();
/**
* Stops playback and optionally resets the player. Use {@
code setPlayWhenReady(false)} rather
*
than this method
if the intention is to pause playback.
* Stops playback and optionally resets the player. Use {@
link #pause()} rather than this method
* if the intention is to pause playback.
*
* <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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment