Closed Bug 1930142 Opened 1 year ago Closed 1 year ago

ogg don't work in moz-extension://

Categories

(WebExtensions :: Compatibility, defect)

Firefox 132
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: Janokisu, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0

Steps to reproduce:

play sound in WebExtensions don't works:
sound = new Audio("xy.ogg");
sound.play();

play sound in WebExtensions works:
sound = new Audio("xy.mp3");
sound.play();

play sound local works:
sound = new Audio("xy.ogg");
sound.play();

Actual results:

Ogg file cannot be played in moz-extension:// but other files (wav, mp3) formats work.
But ogg works local (file://).

It comes the message

HTTP-Content-Type "video/ogg" wird nicht unterstützt. Laden der Medienressource moz-extension://xxxxx/xy.ogg fehlgeschlagen.

Medien konnte nicht abgespielt werden. Keine Dekoder für angefragte Formate: video/ogg

Expected results:

All supported formats can be played in moz-extension://

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: WebExtensions → Core

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Component: Audio/Video: Playback → Compatibility
Product: Core → WebExtensions
Flags: needinfo?(amarchesini)

I'm unable to reproduce the issue. My test is the following:

popup.html:

<html><body><h1>a</h1>
<button id="a">OGG</button><br />
<button id="b">MP3</button>
<script src="popup.js"></script>
</body></html>

popup.js:

document.getElementById("a").onclick = () => {
  const sound = new Audio("xy.ogg");
  sound.play();
}

document.getElementById("b").onclick = () => {
  const sound = new Audio("xy.mp3");
  sound.play();
}

And all works as expected. Can you please provide an STR?

Flags: needinfo?(amarchesini) → needinfo?(Janokisu)

Can you attach the xy.ogg file that reproduces the bug?

Is this issue observed when an extension is loaded temporarily AND when an extension is loaded when packaged?

For future reference, the error is reported from https://searchfox.org/mozilla-central/rev/5fb48bf50516ed2529d533e5dfe49b4752efb8b8/dom/html/HTMLMediaElement.cpp#5253-5260,5273,5287,5298

The MIME type is read from the channel, and in case of moz-extension:-URLs, the extension protocol handler assigns Content-Type based on the URL at ExtensionProtocolHandler::SetContentType. The nsExternalHelperAppService::GetTypeFromURI implementation should return application/ogg for .ogg because it is hardcoded.

When I run the equivalent logic for looking up the MIME type for xy.ogg, I get application/ogg as expected: Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService).getTypeFromURI(Services.io.newURI("https://example.com/xy.ogg"))

... but the error message in the report suggests that somehow the video/ogg MIME type was used instead. This is surprising. The audio/ogg and application/ogg MIME types are supported by OggDecoder::IsSupportedType, but video/ogg is not.

Bug 1240259 may be relevant, as it also reports an inconsistency in the expected MIME type vs actual MIME type.

See Also: → 1240259

It works again 👍

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Flags: needinfo?(Janokisu)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.