Merged
Conversation
8b36dff to
45f25cf
Compare
peaBerberian
commented
May 29, 2023
| } | ||
| playPauseEventsCanceller = new TaskCanceller(); | ||
| playPauseEventsCanceller.linkToSignal(currentContentCanceller.signal); | ||
| if (willAutoPlay !== !videoElement.paused) { |
Collaborator
Author
There was a problem hiding this comment.
Could also be written willAutoPlay === videoElement.paused but I though it was less understandable and that the double negation was, for once, more readable
Merged
b7025bf to
3f398ac
Compare
5a15abd to
79cb512
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
isPausedmethod (#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.