简体   繁体   English

通过不支持的编解码器播放音频文件<audio>标签</audio>

[英]Playing audio files in unsupported codecs through <audio> tag

I've an Electron app where I need to allow the user to play audio files that are in unsupported codecs like CAF/AMR/etc.我有一个 Electron 应用程序,我需要允许用户播放不受支持的编解码器(如 CAF/AMR/等)中的音频文件。 and also let them control playback (play/pause, seek etc.).并让他们控制播放(播放/暂停、搜索等)。

The <audio> tag in Chromium/Electron doesn't natively support this. Chromium/Electron 中的<audio>标签本身并不支持这一点。

How can I add support for it?如何添加对它的支持? I found https://github.com/goldfire/howler.js but it doesn't seem to do it.我找到了 https://github.com/goldfire/howler.js但它似乎没有这样做。

Since it's an Electron app, I can use ffmpeg but I'm not sure how to use it to add support for codecs in the native <audio> tag.由于它是一个 Electron 应用程序,我可以使用 ffmpeg 但我不确定如何使用它在原生<audio>标签中添加对编解码器的支持。

Howler's codec support is reliant on browser support, so if you use a browser which doesn't support the codec , howler.js won't support it either. Howler 的编解码器支持依赖于浏览器支持,因此如果您使用不支持编解码器的浏览器,howler.js 也不会支持它。

It looks like there isn't one plugin which will support all the formats you want, so your only option is to install a javascript plugin for each of the file formats you wish to use.似乎没有一个插件可以支持您想要的所有格式,因此您唯一的选择是为您希望使用的每种文件格式安装 javascript 插件。 For example, here's an AMR player .例如,这是一个 AMR 播放器

For stranger audio formats like Apple's CAF, you might need to convert those files on your server and serve the user a more widely supported format.对于 Apple 的 CAF 等陌生音频格式,您可能需要在服务器上转换这些文件并为用户提供更广泛支持的格式。

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

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