Closed Bug 1415478 Opened 7 years ago Closed 7 years ago

Muted media can always be autoplay when turn on the pref "media.autoplay.enabled.user-gestures-needed"

Categories

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

Other Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Depends on 1 open bug)

Details

Attachments

(3 files)

Since muted autoplay media won't annoy user, so we should allow them to play.
Summary: Muted media can always be autoplay even the pref "media.autoplay.enabled=false" → Muted media can always be autoplay when the pref "media.autoplay.enabled" is false
Depends on: 1382574, 1336400
Summary: Muted media can always be autoplay when the pref "media.autoplay.enabled" is false → Muted media can always be autoplay when turn on the pref "media.autoplay.enabled.user-gestures-needed"
Attachment #8930819 - Flags: review?(jwwang) → review+
Comment on attachment 8928125 [details] Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. https://reviewboard.mozilla.org/r/199376/#review207286 ::: dom/media/AutoplayPolicy.cpp:42 (Diff revision 3) > + if (aElement->Volume() == 0.0 || aElement->Muted()) { > + return true; > + } > + > + // Video without audio track > + if (aElement->IsVideo() && !aElement->HasAudio()) { HasAudio() is valid only after loading metadata while this function could be called before loading metadata.
Attachment #8928125 - Flags: review?(jwwang) → review-
Comment on attachment 8930409 [details] Bug 1415478 - part3 : add tests. https://reviewboard.mozilla.org/r/201576/#review207288 ::: dom/media/test/test_autoplay_block_audible.html:43 (Diff revision 2) > + element.autoplay = true; > + element.src = test.name; > + document.body.appendChild(element); > + > + info("--- check volume and muted ---"); > + is(element.volume, 1.0, `Volume is ${element.volume}`); Include test.name or token in the message so it is easier to identify which test goes wrong. ::: dom/media/test/test_autoplay_muted_audible.html:1 (Diff revision 2) > +<!DOCTYPE HTML> The 4 test cases look alike. Please combine them into one test case.
Comment on attachment 8928125 [details] Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. https://reviewboard.mozilla.org/r/199376/#review207744
Attachment #8928125 - Flags: review?(jwwang) → review+
Comment on attachment 8930409 [details] Bug 1415478 - part3 : add tests. https://reviewboard.mozilla.org/r/201576/#review207764 ::: dom/media/test/test_autoplay_policy.html:28 (Diff revision 4) > + > +function OK(val, msg, token) { > + ok(val, msg + ", token=" + token); > +} > + > +function INFO(msg, token) { You can do the following for polyfill without using different function names. window.info = function(msg, token) { SimpleTest.info(msg + ", token=" + token); }
Attachment #8930409 - Flags: review?(jwwang) → review+
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6739012c4bdf part1 : turn on the pref on Nightly build. r=jwwang https://hg.mozilla.org/integration/autoland/rev/d855c032c823 part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang https://hg.mozilla.org/integration/autoland/rev/447d895b350d part3 : add tests. r=jwwang
(In reply to Dorel Luca [:dluca] from comment #21) > Backed out 3 changesets (bug 1415478) for frequently asserting at > dom/media/MediaDecoderStateMachine.cpp:1009 on a CLOSED TREE wried, I don't think it's related to my change, this assertion happen before running the acutual test cases in test_autoplay_policy.html, and it apparently is related with previous test. I'll push more try-result to see what's happen.
Flags: needinfo?(alwu)
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8a802839959b part1 : turn on the pref on Nightly build. r=jwwang https://hg.mozilla.org/integration/autoland/rev/df6721a3584f part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang https://hg.mozilla.org/integration/autoland/rev/6ba103fe1caf part3 : add tests. r=jwwang
Backed out for frequently asserting in own test test_autoplay_policy.html at MediaDecoderStateMachine.cpp:989: https://hg.mozilla.org/integration/autoland/rev/cd5278f13651bd6c6ce4c04b4395b6831ef0662e Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=6ba103fe1caf880b9ae817869d405e1d6f009f38&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=runnable&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=147812808&repo=autoland [task 2017-11-27T12:09:33.050Z] 12:09:33 INFO - TEST-START | dom/media/test/test_autoplay_policy.html [task 2017-11-27T12:09:33.106Z] 12:09:33 INFO - GECKO(1636) | --DOCSHELL 0xe0671c00 == 2 [pid = 1685] [id = {bb528267-00b6-4960-80cd-76be05ea228a}] [task 2017-11-27T12:09:33.208Z] 12:09:33 INFO - GECKO(1636) | ++DOMWINDOW == 8 (0xdd073800) [pid = 1685] [serial = 36] [outer = 0xe6987040] [task 2017-11-27T12:09:33.327Z] 12:09:33 INFO - GECKO(1636) | ++DOCSHELL 0xdd072400 == 3 [pid = 1685] [id = {03805d45-b59e-4e4e-ad17-af203fbb162f}] [task 2017-11-27T12:09:33.327Z] 12:09:33 INFO - GECKO(1636) | ++DOMWINDOW == 9 (0xe6987ee0) [pid = 1685] [serial = 37] [outer = (nil)] [task 2017-11-27T12:09:33.409Z] 12:09:33 INFO - GECKO(1636) | ++DOMWINDOW == 10 (0xdd074c00) [pid = 1685] [serial = 38] [outer = 0xe6987ee0] [task 2017-11-27T12:09:34.927Z] 12:09:34 INFO - GECKO(1636) | --DOMWINDOW == 8 (0xcbca8400) [pid = 1636] [serial = 15] [outer = (nil)] [url = about:blank] [task 2017-11-27T12:09:40.083Z] 12:09:40 INFO - JavaScript error: /builds/worker/workspace/build/tests/bin/components/httpd.js, line 2889: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIBinaryOutputStream.writeByteArray] [task 2017-11-27T12:09:41.142Z] 12:09:41 INFO - JavaScript error: /builds/worker/workspace/build/tests/bin/components/httpd.js, line 2889: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIBinaryOutputStream.writeByteArray] [task 2017-11-27T12:09:43.084Z] 12:09:43 INFO - GECKO(1636) | --DOMWINDOW == 9 (0xe0670400) [pid = 1685] [serial = 32] [outer = (nil)] [url = http://mochi.test:8888/tests/dom/media/test/test_autoplay_contentEditable.html] [task 2017-11-27T12:09:43.772Z] 12:09:43 INFO - GECKO(1636) | [Child 1685, MediaPlayback #3] WARNING: Decoder=dd15a320 state=SEEKING Audio not synced after seek, maybe a poorly muxed file?: file /builds/worker/workspace/build/src/dom/media/MediaDecoderStateMachine.cpp, line 1208 [task 2017-11-27T12:09:45.994Z] 12:09:45 INFO - GECKO(1636) | --DOMWINDOW == 8 (0xe6987700) [pid = 1685] [serial = 33] [outer = (nil)] [url = about:blank] [task 2017-11-27T12:09:46.433Z] 12:09:46 INFO - JavaScript error: /builds/worker/workspace/build/tests/bin/components/httpd.js, line 2889: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIBinaryOutputStream.writeByteArray] [task 2017-11-27T12:09:49.824Z] 12:09:49 INFO - GECKO(1636) | --DOMWINDOW == 7 (0xe0672800) [pid = 1685] [serial = 34] [outer = (nil)] [url = about:blank] [task 2017-11-27T12:09:49.825Z] 12:09:49 INFO - GECKO(1636) | --DOMWINDOW == 6 (0xdd072800) [pid = 1685] [serial = 35] [outer = (nil)] [url = http://mochi.test:8888/tests/SimpleTest/iframe-between-tests.html] [task 2017-11-27T12:09:51.645Z] 12:09:51 INFO - JavaScript error: /builds/worker/workspace/build/tests/bin/components/httpd.js, line 2889: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIBinaryOutputStream.writeByteArray] [task 2017-11-27T12:09:53.706Z] 12:09:53 INFO - GECKO(1636) | Assertion failure: !mDoneAudioSeeking, at /builds/worker/workspace/build/src/dom/media/MediaDecoderStateMachine.cpp:989 [task 2017-11-27T12:10:30.550Z] 12:10:30 INFO - GECKO(1636) | #01: mozilla::MediaDecoderStateMachine::AccurateSeekingState::HandleEndOfAudio [dom/media/MediaDecoderStateMachine.cpp:989] [task 2017-11-27T12:10:30.551Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.551Z] 12:10:30 INFO - GECKO(1636) | #02: mozilla::MediaDecoderStateMachine::AccurateSeekingState::OnSeekRejected [dom/media/MediaDecoderStateMachine.cpp:1147] [task 2017-11-27T12:10:30.552Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.553Z] 12:10:30 INFO - GECKO(1636) | #03: mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::SeekRejectValue, true>::ThenValue<mozilla::MediaDecoderStateMachine::AccurateSeekingState::DemuxerSeek()::<lambda(const mozilla::media::TimeUnit&)>, mozilla::MediaDecoderStateMachine::AccurateSeekingState::DemuxerSeek()::<lambda(const mozilla::SeekRejectValue&)> >::DoResolveOrRejectInternal [xpcom/threads/MozPromise.h:520] [task 2017-11-27T12:10:30.555Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.557Z] 12:10:30 INFO - GECKO(1636) | #04: mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::SeekRejectValue, true>::ThenValueBase::ResolveOrRejectRunnable::Run [mfbt/RefPtr.h:63] [task 2017-11-27T12:10:30.559Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.560Z] 12:10:30 INFO - GECKO(1636) | #05: mozilla::AutoTaskDispatcher::TaskGroupRunnable::Run [xpcom/threads/TaskDispatcher.h:217] [task 2017-11-27T12:10:30.561Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.563Z] 12:10:30 INFO - GECKO(1636) | #06: mozilla::TaskQueue::Runner::Run [xpcom/threads/TaskQueue.cpp:242] [task 2017-11-27T12:10:30.564Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.565Z] 12:10:30 INFO - GECKO(1636) | #07: nsThreadPool::Run [xpcom/threads/nsThreadPool.cpp:228] [task 2017-11-27T12:10:30.566Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.568Z] 12:10:30 INFO - GECKO(1636) | #08: nsThread::ProcessNextEvent [mfbt/Maybe.h:100] [task 2017-11-27T12:10:30.573Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.574Z] 12:10:30 INFO - GECKO(1636) | #09: NS_ProcessNextEvent [xpcom/threads/nsThreadUtils.cpp:508] [task 2017-11-27T12:10:30.574Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.575Z] 12:10:30 INFO - GECKO(1636) | #10: mozilla::ipc::MessagePumpForNonMainThreads::Run [ipc/glue/MessagePump.cpp:335] [task 2017-11-27T12:10:30.576Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.578Z] 12:10:30 INFO - GECKO(1636) | #11: MessageLoop::RunInternal [ipc/chromium/src/base/message_loop.cc:327] [task 2017-11-27T12:10:30.579Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.580Z] 12:10:30 INFO - GECKO(1636) | #12: MessageLoop::Run [ipc/chromium/src/base/message_loop.cc:298] [task 2017-11-27T12:10:30.581Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.582Z] 12:10:30 INFO - GECKO(1636) | #13: nsThread::ThreadFunc [xpcom/threads/nsThread.cpp:425] [task 2017-11-27T12:10:30.583Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.632Z] 12:10:30 INFO - GECKO(1636) | #14: _pt_root [nsprpub/pr/src/pthreads/ptthread.c:219] [task 2017-11-27T12:10:30.632Z] 12:10:30 INFO - [task 2017-11-27T12:10:30.633Z] 12:10:30 INFO - GECKO(1636) | #15: libpthread.so.0 + 0x6295
Flags: needinfo?(alwu)
The assertion is very likely related with the bug1416799, push another try-result [1] with the patch of bug1416799 to see what would happen. [1] https://treeherder.mozilla.org/#/jobs?repo=try&revision=a2d6d4a136c28ddcdf6fb65c9b018309209f5acc
Flags: needinfo?(alwu)
We didn't get any fail on the try-result in comment 30 (run 20 times), the bug 1416799 could eliminate the assertion fail. We could land this bug after fixing the bug1416799.
Depends on: 1416799
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/972288371a57 part1 : turn on the pref on Nightly build. r=jwwang https://hg.mozilla.org/integration/autoland/rev/4a4b3c541465 part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang https://hg.mozilla.org/integration/autoland/rev/1762ac4166c9 part3 : add tests. r=jwwang
Depends on: 1420436
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: