简体   繁体   English

在 HTML 页面中播放 .m4a 音频文件不起作用

[英]Playing an .m4a audio file in an HTML page doesn't work

I'm trying to play an m4a file on a webpage and it doesn't work.我正在尝试在网页上播放m4a文件,但它不起作用。 I'm using the voice memo app on an iPhone to generate these files.我正在使用 iPhone 上的语音备忘录应用程序来生成这些文件。

I notice the following (Findings):我注意到以下(调查结果):

  • When I switch my settings IOS > Settings > voice memo > Audio quality to compressed it works.当我将设置 IOS > 设置 > 语音备忘录 > 音频质量切换为压缩时,它可以工作。
  • When I switch my settings IOS > Settings > voice memo > Audio quality to Lossless it doesn't work.当我将设置 IOS > 设置 > 语音备忘录 > 音频质量切换为无损时,它不起作用。

The problem问题

The problem is that all the files that I need to use were generated using the Lossless setting.问题是我需要使用的所有文件都是使用无损设置生成的。

Any ideas???有任何想法吗???

  • why the browser is not playing these files?为什么浏览器不播放这些文件?
  • any suggestions to make it work?有什么建议让它发挥作用吗?

Here is my snippet:这是我的片段:

<audio controls>
  <source src="fileURL">
  <source src="fileURL">
Your browser does not support the audio element.
</audio>

Thank you guys!感谢你们!

The lossless files will most likely be encoded with Apple Lossless .无损文件很可能使用Apple Lossless进行编码。 As the name implies this is the format that Apple software uses to produce lossless files.顾名思义,这是 Apple 软件用于生成无损文件的格式。 To be sure you could open the files with Quicktime or iTunes to see what codec is used.确保您可以使用 Quicktime 或 iTunes 打开文件以查看使用的编解码器。

As far as I remember not even Safari for iOS does play Apple Lossless files natively.据我所知,甚至 iOS 的 Safari 都不能原生播放 Apple 无损文件。 If you can't re-encode the files alac.js could be an alternative.如果您无法重新编码文件alac.js可能是一种替代方法。 It's an Apple Lossless decoder written in JavaScript.这是用 JavaScript 编写的 Apple 无损解码器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM