-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix a few inconsistencies between the media element spec and implementations #11792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
54fe603 to
efca938
Compare
|
For (1), doesn't this follow from JS semantics, regardless of what the setter does (so long as it doesn't throw)? |
|
I'm sure you're right, I haven't worked closely with the JS spec. In that case, the change to specify the the value of the assignment is unnecessary, but I believe the point still stands that the playback position on the timeline is not guaranteed to be immediately observable by a script after seeking begins, with the parallel nature of the steps as they stand currently. I'm not able to update the PR at the moment, but when I'm back home I'll remove the first part of that change. |
efca938 to
23dc2e9
Compare
|
Just remembered to get back to this, I've removed the part defining the result of the assignment. Setting the official playback position is still moved within the seek algorithm, though, as that result needs to clamp to the seekable regions in order to match the implementations. |
This change ensures that the new playback position on the valid media timeline is observable immediately following an assignment to a media element's currentTime attribute. It will also be immediately observable after calling fastSeek(). In order to prevent overwriting of the new playback position when pausing, the setting of the official playback position in the pause steps now only runs if not seeking. Fixes whatwg#11773
The existing steps cause a seek to the end of the media resource while paused to seek to the start immediately after. This differs from implementations in Chrome, Firefox and Safari. Fixes whatwg#11774
Before this change, allowing playback to end, then subsequently setting the loop attribute to true, would result in the ended attribute being false, and playback not restarting when the play steps are run. Fixes whatwg#11775
23dc2e9 to
0ca7611
Compare
|
I've updated the first commit to fix another bug where the official playback position would revert to the last available position if the media element is paused in the middle of a seek. To do so, the pause steps now skip setting the official playback position if a seek is in progress. |
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
The spec's steps for pausing an HTMLMediaElements prescribe setting the official playback position to the current playback position, but the seeking steps are not synchronous, so there's no guarantee that the current playback position reflects the seek. Therefore, we need to skip that step if we're in the middle of a seek. This is included in a pull request to the HTML spec: whatwg/html#11792
This fixes a few inconsistencies between the spec and browsers' implementations of a few behaviors:
Media elements' seek steps do not set the official playback position before parallel steps begin #11773: A script is not immediately guaranteed to receive a playback position on the media timeline after setting
currentTime:The fix for this issue is to specify that the
currentTimesetter returns the value passed to it, and that the seek steps should synchronously set the official playback position to the chosen new playback position after clamping it to the earliest possible position, the duration, and the seekable ranges. This also ensures thatcurrentTimereflects the new playback time after callingfastSeek(), which matches Firefox and Safari behavior.Media elements can loop if they reach the end of media playback while paused #11774: Seeking to the end of a video while paused loops to the start:
In order to fix this, when reaching the end of playback while the loop attribute is set, the seek to the earliest position is only run when not paused. In order to allow playback to restart when that condition does not pass, the internal play steps must then seek to the start if looping was skipped due to being paused the last time they were run.
Media element is not considered to have ended playback if loop is enabled after reaching the end #11775: Finally, if the
loopattribute is set after playback has ended:This is solved by specifying that playback has ended when the
loopattribute was specified the last time that the end of playback was reached, meaning that modifying it before playback ends again does not affect the value of theendedattribute. This also allows playback to restart from the beginning even after specifyingloopwhile playback is ended.(See WHATWG Working Mode: Changes for more details.)