Closed
Bug 1435133
Opened 7 years ago
Closed 7 years ago
AutoplayPolicy::IsMediaElementAllowedToPlay() can race and fail on videos without audio track
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: cpearce, Assigned: cpearce)
References
Details
Attachments
(3 files)
The code in AutoplayPolicy::IsMediaElementAllowedToPlay() has logic that says if we've loaded metadata and we know the video doesn't have an audio track it's allowed to play, otherwise we'll block playback. However if we runs this check for a video without an audio track that is loading and we run this check before it's reached loadedmetadata, we'll block it from playing, and there's nothing to cause it to start playing.
For example, if we:
1. Load http://pearce.org.nz/video/320x240.ogg in a video.
2. Immediately call play(); the video won't have time to reach loadedmetadata, and so will have playback blocked.
This is an inaudible video, so we should be expected to play.
We can either decide we don't care, or maybe we can delay resolving the play() promise until we've loadedmetadata?
Updated•7 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•7 years ago
|
||
This test case should play, but does not.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 4•7 years ago
|
||
mozreview-review |
Comment on attachment 8966087 [details]
Bug 1435133 - Don't play until we've reached metadata.
https://reviewboard.mozilla.org/r/234826/#review240698
LGTM, comment nit.
::: dom/html/HTMLMediaElement.cpp:3997
(Diff revision 1)
> // run the following steps.
>
> // 4.8.12.8 - Step 1:
> // If the media element is not allowed to play, return a promise rejected
> // with a "NotAllowedError" DOMException and abort these steps.
> - if (!IsAllowedToPlay()) {
> + if (mReadyState >= HAVE_METADATA && !IsAllowedToPlay()) {
Could we expand the above comment to explain that if we do not have metadata yet we cannot figure out if we're allowed to play?
Attachment #8966087 -
Flags: review?(bvandyk) → review+
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8966088 [details]
Bug 1435133 - Test that we delay media play start until we know whether a media has audio or not.
https://reviewboard.mozilla.org/r/234828/#review240708
Attachment #8966088 -
Flags: review?(bvandyk) → review+
Pushed by cpearce@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/41039837009c
Test that we delay media play start until we know whether a media has audio or not. r=bryce
Comment 7•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Comment 8•7 years ago
|
||
Other part of the patch landed with wrong bug number (bug 1435134):
https://hg.mozilla.org/integration/mozilla-inbound/rev/72144da2637d
https://hg.mozilla.org/mozilla-central/rev/72144da2637d
Updated•7 years ago
|
Assignee: nobody → cpearce
Updated•7 years ago
|
QA Whiteboard: [good first verify]
Comment 9•5 years ago
|
||
For future reference: the 'Bug 1435133 - Don't play until we've reached metadata.' patch landed with the wrong number in it's title.
You need to log in
before you can comment on or make changes to this bug.
Description
•