如何在 PHP 中获取 m4a 音频文件长度

发布于 2025-01-12 05:49:32 字数 283 浏览 3 评论 0原文

我有一个 php 生成的页面,其中列出了数百个带有音频控件的 m4a 音频文件。

如果我使用 <音频预加载=“元数据” 由于从所有音频文件获取元数据超时,它不会加载所有文件。

如果我使用 <音频预加载=“无” 它加载良好,当我单击“播放”时,它会显示我单击“播放”时没有问题的 m4a 文件的长度(持续时间)。

有没有办法读取 PHP 中 m4a 文件的持续时间,以便我可以显示它?我可以在 php 中获取 mp3 的持续时间,但在任何地方都找不到如何在 PHP 中获取 m4a 音频文件的持续时间

I have a php generated page that lists a few hundred m4a audio files with the audio controls.

If I use
<audio preload="metadata"
it doesn't load all the files due to timeouts getting the meta data from all the audio files.

If I use
<audio preload="none"
it loads fine and when I click play it shows the length (duration) of the m4a file I clicked play on no problem.

Is there a way to read the duration of the m4a file in PHP so I can display that? I can get the duration of an mp3 in php but can't find anywhere how to get the duration of an m4a audio file in PHP

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文