Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As I've been working a lot more with application code (media player UIs) lately, I saw that a real concept of whether playback was playing or paused was missing in the RxPlayer API.
You could approximate it by getting the player's state, but some states, like
"BUFFERING"
or"LOADING"
, even if they indicate that playback is not happening right now, do not indicate whether we're actually paused or not.For example, once the buffering period is over, will we play directly or still be paused? Or, after
"LOADING"
, will we play or just be paused on the first loaded frame?One area where this concept is central to an application is for example to know whether the "play/pause" button should currently play or pause, which also dictates what the button should look like: if we're playing, this is a pause button which will pause playback, if we're paused, it will be a play button starting playback - and this, regardless of the current player's state.
That's the reason the
isPaused
method (#1248) is planned for the futurev3.31.0
. While writing the beginning of that release's release note, I however noticed that the API wouldn't be complete without"play"
and"pause"
events, indicating respectively when the player exits a pause and when it enters it.This PR adds those two events.