流式音频与HTML5`<音频>`标签 [英] streaming audio with html5 `<audio>` tag

查看:293
本文介绍了流式音频与HTML5`<音频>`标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用&LT流从一个系列讲座由Dreamhost的托管站点音频,音频> 标签在HTML5中,但不是很成功。实际code是

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>

我也有一个.htaccess文件,包括正确的MIME类型为Apache。

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

将AddType音频/ OGG .OGG

AddType audio/ogg .ogg

将AddType音频/ MPEG .MP3

AddType audio/mpeg .mp3

对Ogg文件是约8兆和MP3文件大约13兆。每个文件是从Audacity的出口。

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

一切都在FF,Chrome和Safari浏览器时,在我的Windows本地提供7机(运行的Apache 2.2.14和PHP 5.3.1的Win32版本)中扮演的罚款。

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).

事情并不那么好走Dreamhost上。 (他们运行Apache 2.2.15和PHP 5.2.14)。
FF 5秒后停止播放音频文件。 Chrome浏览器播放音频文件,但音频经常跳过。 Safari浏览器正确地播放音频,但点击播放按钮和音频真正开始流传输并播放之间的时间差大约是3分钟。

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.

如果不是使用&LT;音频方式&gt; 标签,我打从Dreamhost的MP3文件与Silverlight的球员,他们流和正常播放

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

什么,我需要做的就是在&LT任何建议;音频&GT; 标记才能正常工作。据我所知,HTML5音频客户端技术,为的是Silverlight的。所以,理论上,Dreamhost的应该对如何使用&LT没有影响;音频&GT; 标记执行。

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.

感谢。

推荐答案

造成通过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.

这就是答案在这里。

这篇关于流式音频与HTML5`&LT;音频&GT;`标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆