Audio canplaythrough event does not fire when loaded from URL.createObjectURL source created from a Blob created from an arraybuffer loaded via XMLHttpRequest

VERIFIED FIXED in Firefox -esr60

Status

()

VERIFIED FIXED
10 months ago
8 months ago

People

(Reporter: eniko, Assigned: jya)

Tracking

({regression})

59 Branch
mozilla62
regression
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox-esr60 fixed, firefox59 wontfix, firefox60 wontfix, firefox61 fixed, firefox62 verified)

Details

Attachments

(3 attachments)

(Reporter)

Description

10 months ago
Created attachment 8971756 [details]
FirefoxCanPlayThroughTest.zip

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180323154952

Steps to reproduce:

I load an OGG file via XMLHttpRequest with responseType arraybuffer. I then create a Blob using that arraybuffer with type audio/ogg, and pass that to URL.createObjectURL.

After this I create an audio element, add the canplaythrough even listener, set preload to auto, set src to the url created via URL.createObjectURL, and call the load function.

Can confirm this used to work as late as December 2017. Using responseType blob instead of arraybuffer seems to have the expected result. Code that minimally reproduces the issue has been attached as a zip.


Actual results:

The canplaythrough event never fires and readyState is stuck at 3 (HAVE_FUTURE_DATA).


Expected results:

The canplaythrough event should fire and readyState should be set to 4 (HAVE_ENOUGH_DATA). This used to be the case as late as December 2017.
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Firefox: 61.0a1, Build ID: 20180501220047

I have managed to reproduce this issue on latest Firefox (59.0.3) release and latest Nightly (61.0a1) build. After I have opened the attached test case, nothing happened and the "3" message was displayed in browser console.
However, I have also tested this on an older Nightly build (build from 2017-12-01) and the issue is not reproducible. After I have opened the provided test case, a "can-play-through" dialog appeared and the "4" message was displayed in browser console after I clicked the "OK" button.

Considering this, I have found the regression window using the mozregression tools. Here are the results:
Last good revision: 772fef647fd7750f8c87dfd4f55bbd85046a555a
First bad revision: 821560cd716d50fbb0c49d0170bd351255e55bc3
Pushlog: https://goo.gl/VYxvVL

Looks like bug 1423465 introduced this issue.
Wang, can you please take a look at this?
Blocks: 1423465
status-firefox59: --- → affected
status-firefox60: --- → affected
status-firefox61: --- → affected
status-firefox-esr52: --- → unaffected
Component: Untriaged → Audio/Video: Playback
Flags: needinfo?(suro001)
Keywords: regression
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Updated

10 months ago
Flags: needinfo?(jyavenard)
(Assignee)

Comment 2

10 months ago
:jw_wang unfortunately no longer works at mozilla.
Flags: needinfo?(suro001)
status-firefox59: affected → wontfix
status-firefox60: affected → fix-optional
(Assignee)

Updated

9 months ago
Duplicate of this bug: 1462967
(Assignee)

Comment 4

9 months ago
Bug was introduced in P5 of bug 1423465
https://hg.mozilla.org/integration/autoland/rev/a493885e5a0d

Prior P5, ChannelMediaDecoder::CanPayThroughImpl() would calculate the playback rate synchronously when called.

However, following P5, mCanPlayThrough is cached and only calculated through ChannelMediaDecoder::DownloadProgressed()

This method is never called as the resource has completed loading when we use an arraybuffer
Flags: needinfo?(jyavenard)
(Assignee)

Updated

9 months ago
Assignee: nobody → jyavenard
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Comment 7

9 months ago
Could you please try with this build ?

https://queue.taskcluster.net/v1/task/NnuNIIaPQf-hADmEAJ4-ig/runs/0/artifacts/public/build/target.zip

simply unzip and run the firefox.exe 

thank you
Flags: needinfo?(eniko)

Comment 8

9 months ago
mozreview-review
Comment on attachment 8981248 [details]
Bug 1457661 - P1. Add mochitest.

https://reviewboard.mozilla.org/r/247328/#review253568

::: dom/media/test/test_arraybuffer.html:4
(Diff revision 1)
> +<!DOCTYPE HTML>
> +<html>
> +<!--
> +https://bugzilla.mozilla.org/show_bug.cgi?id=1462967

Should the test reference bug 1457661 since we're landing it against that bug and 1462967 is marked as a dupe?

::: dom/media/test/test_arraybuffer.html:7
(Diff revision 1)
> +<html>
> +<!--
> +https://bugzilla.mozilla.org/show_bug.cgi?id=1462967
> +-->
> +<head>
> +  <title>Test for Bug 462957</title>

Missing first digit of bug

::: dom/media/test/test_arraybuffer.html:69
(Diff revision 1)
> +    });
> +    const blob = new Blob([arr], {type:test.type});
> +    const blobUrl = URL.createObjectURL(blob);
> +
> +    document.body.appendChild(v);
> +    v.preload = "auto"

Missing semicolon
Attachment #8981248 - Flags: review?(bvandyk) → review+

Comment 9

9 months ago
mozreview-review
Comment on attachment 8981249 [details]
Bug 1457661 - P2. Ensure we call NotifyDataEnded for local resource once size is known.

https://reviewboard.mozilla.org/r/247330/#review253598
Attachment #8981249 - Flags: review?(bvandyk) → review+
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Comment 12

9 months ago
mozreview-review-reply
Comment on attachment 8981248 [details]
Bug 1457661 - P1. Add mochitest.

https://reviewboard.mozilla.org/r/247328/#review253568

> Should the test reference bug 1457661 since we're landing it against that bug and 1462967 is marked as a dupe?

oops of course.

> Missing semicolon

thanks for the reviews

Comment 13

9 months ago
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8569fdbf5a12
P1. Add mochitest. r=bryce
https://hg.mozilla.org/integration/autoland/rev/27562071aaaa
P2. Ensure we call NotifyDataEnded for local resource once size is known. r=bryce

Comment 14

9 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/8569fdbf5a12
https://hg.mozilla.org/mozilla-central/rev/27562071aaaa
Status: NEW → RESOLVED
Last Resolved: 9 months ago
status-firefox62: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
(Reporter)

Comment 15

9 months ago
(In reply to Jean-Yves Avenard [:jya] from comment #7)
> Could you please try with this build ?
> 
> https://queue.taskcluster.net/v1/task/NnuNIIaPQf-hADmEAJ4-ig/runs/0/
> artifacts/public/build/target.zip
> 
> simply unzip and run the firefox.exe 
> 
> thank you

This works as expected. Thanks for the fix!
Flags: needinfo?(eniko)
status-firefox60: fix-optional → wontfix
status-firefox-esr60: --- → affected
Flags: in-testsuite+
(Assignee)

Updated

9 months ago
Status: RESOLVED → VERIFIED
Please request Beta approval on this when you feel that it has had sufficient bake time.
status-firefox62: fixed → verified
Flags: needinfo?(jyavenard)
(Assignee)

Comment 17

9 months ago
Comment on attachment 8981248 [details]
Bug 1457661 - P1. Add mochitest.

Approval Request Comment
[Feature/Bug causing the regression]: bug 1423465
[User impact if declined]: some content will no longer autoplay, now will the proper events be fired
[Is this code covered by automated tests?]: yes, new tests added.
[Has the fix been verified in Nightly?]: yes
[Needs manual test from QE? If yes, steps to reproduce]:  none
[List of other uplifts needed for the feature/fix]: all patches (one are the tests)
[Is the change risky?]: no.
[Why is the change risky/not risky?]: we force dispatching the required event. Even before the regression caused by bug 1423465, the bug was there, just hidden.
[String changes made/needed]:
Flags: needinfo?(jyavenard)
Attachment #8981248 - Flags: approval-mozilla-esr60?
Attachment #8981248 - Flags: approval-mozilla-beta?
Comment on attachment 8981248 [details]
Bug 1457661 - P1. Add mochitest.

Fixes broken autoplay under some circumstances. Thanks for writing a new test for this! Approved for 61.0b11.
Attachment #8981248 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment on attachment 8981248 [details]
Bug 1457661 - P1. Add mochitest.

This has baked for awhile on Nightly and Beta without any known issues. Approved for ESR 60.1 as well.
Attachment #8981248 - Flags: approval-mozilla-esr60? → approval-mozilla-esr60+
Duplicate of this bug: 1448181
You need to log in before you can comment on or make changes to this bug.