最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Firefox plays no M4A audio file from the internet, localhost is working - Stack Overflow

programmeradmin2浏览0评论

I have a strange problem and already lost several hours on it:

When I try to play any M4A audio file from a web location in Firefox I get an error message that the video format or mime type is not supported. But when I download the same M4A file an play it locally from disk in Firefox it is working.

I tried it with this file: .m4a

In Chrome and IE everything works. I use Firefox 53, 32-bit version.

Has anyone an idea how I can solve this in Firefox?

UPDATE:

I set up a test page to clarify the differences in Firefox:

The result is interesting: The first M4A file is played without problems if called from a link directly, but doesn't play when called as Javascript Audio. The second file is the opposite.

So the question is, how can I get Firefox to set the mime type correctly when loaded as a Javascript Audio Element?

I have a strange problem and already lost several hours on it:

When I try to play any M4A audio file from a web location in Firefox I get an error message that the video format or mime type is not supported. But when I download the same M4A file an play it locally from disk in Firefox it is working.

I tried it with this file: http://techslides./demos/samples/sample.m4a

In Chrome and IE everything works. I use Firefox 53, 32-bit version.

Has anyone an idea how I can solve this in Firefox?

UPDATE:

I set up a test page to clarify the differences in Firefox:

http://123-bb.de/tests/audiotest

The result is interesting: The first M4A file is played without problems if called from a link directly, but doesn't play when called as Javascript Audio. The second file is the opposite.

So the question is, how can I get Firefox to set the mime type correctly when loaded as a Javascript Audio Element?

Share Improve this question edited May 5, 2017 at 8:42 dcman asked May 4, 2017 at 20:40 dcmandcman 911 silver badge7 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

The issue with Firefox and m4a format is due to licensing. Browser is using built-in OS libraries to play the file to not pay the license fee. The m4a file to be played needs to be in mp4 container - it needs to have audio/mp4 MIME type.

The file you have linked when played from the link has - audio/mpeg. When I tried embeding it in JSFiddle firefox detect it correctly as - audio/mp4 due to server configuration. You can control the MIME type of a file but only on your server, more on that here.

I got the answer to my question from the Firefox team:

https://bugzilla.mozilla/show_bug.cgi?id=1362358

In short: There are 2 different ways how Firefox looks up the mime type. When the audio file is called from a Javascript audio object, Firefox ignores the mime type from the http response and detects it by sniffing into the audio file. My M4A files have a 3gpp encoding and this codec is not supported by Firefox.

发布评论

评论列表(0)

  1. 暂无评论