使用 html5 `

发布于 2024-09-24 20:29:52 字数 1080 浏览 2 评论 0原文

我正在尝试使用 html5 中的 标签在 Dreamhost 托管的网站上播放系列讲座中的音频,但没有取得太大成功。实际的代码是

<audio id="playerTwo" class="player" controls="controls" preload="none">
<source src="audio.ogg" type="audio/ogg; codecs='vorbis'"/>
<source src="audio.mp3" type="audio/mpeg"/>
</audio>

我还有一个 .htaccess 文件来包含 apache 的正确 mime 类型。

AddType audio/ogg .ogg

AddType audio/mpeg .mp3

ogg 文件约为 8 megs,mp3 文件约为 13 megs。每个文件都是从 Audacity 导出的。

当在我的 Windows 7 机器上本地运行时(运行 win32 版本的 apache 2.2.14 和 php 5.3.1),一切在 FF、Chrome 和 Safari 中运行良好。

Dreamhost 的情况不太顺利。 (他们运行 apache 2.2.15 和 php 5.2.14。) FF 在 5 秒后停止播放音频文件。 Chrome 播放音频文件,但音频经常跳动。 Safari 可以正确播放音频,但单击播放按钮与音频实际开始流式传输和播放之间的延迟约为三分钟。

如果我不使用 标签,而是使用 Silverlight 播放器播放 Dreamhost 中的 mp3 文件,则它们可以正确进行流式传输并播放。

有关我需要做什么才能使 标签正常工作的任何建议。据我所知,html5音频是客户端技术,Silverlight也是如此。因此,理论上,Dreamhost 应该不会影响 标签的执行方式。

无论如何,任何人都对出了什么问题有任何想法。

谢谢。

I am trying to stream audio on a site hosted by Dreamhost from a lecture series using the <audio> tag in html5, but without much success. The actual code is

<audio id="playerTwo" class="player" controls="controls" preload="none">
<source src="audio.ogg" type="audio/ogg; codecs='vorbis'"/>
<source src="audio.mp3" type="audio/mpeg"/>
</audio>

I also have an .htaccess file to include the correct mime-types for apache.

AddType audio/ogg .ogg

AddType audio/mpeg .mp3

The ogg files are about 8 megs and mp3 files are about 13 megs. Each file was exported from Audacity.

Everything plays fine in FF, Chrome and Safari when served locally on my windows 7 machine (running a win32 version of apache 2.2.14 and php 5.3.1).

Things do not go so well on Dreamhost. (They run apache 2.2.15 and php 5.2.14.)
FF stops playing the audio file after 5 seconds. Chrome plays the audio file, but the audio skips frequently. Safari plays the audio correctly, but the lag between clicking the play button and the audio actually starting to stream and play is about three minutes.

If instead of using the <audio> tag, I play the mp3 files from Dreamhost with a Silverlight player, they stream and play correctly.

Any suggestions about what I need to do to get the <audio> tag to work correctly. As far as I know, html5 audio is client-side technology, as is Silverlight. So, in theory, Dreamhost should have no effect on how the <audio> tag performs.

Anyway, anyone have any ideas about what is amiss.

Thanks.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍风燃霜 2024-10-01 20:29:52

通过 filezilla 以 ascii 传输类型而不是二进制传输类型上传音频文件导致的问题。音频文件在上传过程中被损坏,因此播放效果不佳也就不足为奇了。令人惊讶的是,mp3 文件的播放效果确实可以接受,但 ogg 文件的播放效果却不佳。

这就是答案。

Problem caused by uploading audio files through filezilla in ascii transfer type, rather than binary transfer type. The audio files were corrupted during upload, so no big surprise that they didn't play well. The surprise is that the mp3 files did play acceptably, though the ogg files did not.

That's the answer here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文