Closed Bug 1506290 Opened 6 years ago Closed 5 years ago

Implement `document.autoplayPolicy` API

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

`document.autoplayPolicy` returns a enum string that can change overtime based on user session activity [1]:

- “allowed” if autoplay is currently allowed.
- “allowed-muted” if muted video autoplay is currently allowed.
- “disallowed” is autoplay is not current allowed.
- “prompt” if autoplay will trigger a prompt

[1] https://github.com/WICG/autoplay/issues/1
`document.autoplayPolicy` returns a enum string that can change overtime based on user session activity:

- “allowed” if autoplay is currently allowed.
- “allowed-muted” if muted video autoplay is currently allowed.
- “disallowed” is autoplay is not current allowed.
- “prompt” if autoplay will trigger a prompt
Before fixing bug1493766, we can't write tests because now AutoplayPolicy::IsAllowedToPlay() would return incorrectly result under some situaions. 

I will write the wpt-test after fixing bug1493766.
Depends on: 1493766
The proposal [1] defines that `document.autoplayPolicy` returns a single enum string, but it doesn't meet our current implementation. “allowed-muted” and “prompt” can exist at the same time. 

Therefore, we can't implement this API now, we need to wait for the decision about whether shipping the doorhanger. If not, we can implement this single enum version, but if we want to ship with doorhanger, we need to modify the proposal in order to make API return multiple enums strings.
Priority: -- → P2
Attachment #9024153 - Attachment description: Bug 1506290 - implement 'document.autoplayPolicy'. → Bug 1506290 - part1 : implement 'document.autoplayPolicy'.
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/63c3828351f0
part1 : implement 'document.autoplayPolicy'. r=baku,cpearce
https://hg.mozilla.org/integration/autoland/rev/3420cf8f79a9
part2 : add test. r=cpearce
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66

:cmills-- when we get to the docs for this one, I'll take it.

(In reply to Eric Shepherd [:sheppy] from comment #8)

:cmills-- when we get to the docs for this one, I'll take it.

WFM; I've added you to the relevant MDN roadmap card: https://trello.com/c/4emMB6Y8/146-autoplay-api-fx-66

Again, I don't think this is available in 66; see https://bugzilla.mozilla.org/show_bug.cgi?id=1487844#c9. I could be wrong.

This API is controled by the pref "dom.media.autoplay.autoplay-policy-api", which is default off. If user turns on this pref in 66, then they can use the API no matter whether we enable blocking autoplay or not.

I've added this to the "experimental features in Firefox" page. It's currently mentioned on the Fx for 66 page, but can be removed if we decide to.

No longer blocks: 1506289
Depends on: 1506289

(In reply to Eric Shepherd [:sheppy] from comment #12)

I've added this to the "experimental features in Firefox" page. It's currently mentioned on the Fx for 66 page, but can be removed if we decide to.

It sounds good to me to mention that this API is just an experimental feature which hasn't be a part of the offical spec, thank you.

The docs for this one sound done, for now.

Blocks: 1814985
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: