Closed Bug 1412772 Opened 7 years ago Closed 6 years ago

website should handle rejected promise from video.play() properly when the pref "media.autoplay.enabled=false"

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

Other Branch
enhancement

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: alwu, Unassigned)

References

Details

(Keywords: dev-doc-complete)

When set the pref "media.autoplay.enabled=false", we would stop any automatically play() invocation and reject the promise.

Websites should handle that rejected promise properly and then change their player UI to correct state.

It's defined by spec [1]

`If the media element is not allowed to play, return a promise rejected with a "NotAllowedError" DOMException and abort these steps.`

and we indeed reject the promise [2]

eg. Youtube would keep their controller's button as playing even we've prevented video playing

[1] https://html.spec.whatwg.org/multipage/media.html#dom-media-play
[2] http://searchfox.org/mozilla-central/rev/b52285fffc13f36eca6b47de735d4e4403b3859e/dom/html/HTMLMediaElement.cpp#4014
There is nothing we can fix here aside from contacting sites.
Priority: -- → P3
Here is the list about the websites showing the wrong UI, see "Websites testing".

https://docs.google.com/document/d/1J0kgSHEOhb8aiRQTEPBxeKZGWni4gP7GiH0MGCUkNcU/edit#
Adding dev-doc-needed to be sure we fully document this recommendation.
Keywords: dev-doc-needed
Closing. We intend to write a blog post documenting our autoplay behaviour.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
I updated the page about HTMLMediaElement.play() with one specifically covering this scenario, and replaced the example on that page with one that covers this scenario.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play
Looks good, thanks Eric.
You need to log in before you can comment on or make changes to this bug.