• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

在网页嵌入音频的最佳方式

用户头像
it1352
帮助1

问题说明

我知道,我知道。这听起来很可怕,但这是客户想要的,他们非常关注这个想法。我现在想找出实现它的最佳方法。 Flash是理想的,但客户希望避免使用它。

I know, I know. It sounds horrific, but it's what the client wants, and they're very set on the idea. It's now come to me to figure out the best way make it happen. Flash would be ideal but the client wants to avoid using it.

这是一个数字音频文件,因此我可以将其转换为任何可能使事情变得更容易的格式(例如MP3)或者OGG)但它至少需要支持IE 8 ,FF 3.5 ,Safari和Chrome。它需要自动播放,有隐藏的控件(我知道,我知道),希望它会循环。

It's a digital audio file, so I can convert it to any format that might make things easier (e.g. MP3 or OGG) but it needs to support IE 8 , FF 3.5 , Safari and Chrome at the very least. It needs to autoplay, have hidden controls (I know, I know) and hopefully it will loop.

我会倾向于 HTML5音频,但我不确定IE8是否会支持它(虽然我想IE8我可以使用条件注释?)。

I would lean towards HTML5 audio, but I'm not sure if IE8 will support it (although I suppose for IE8 I could use Conditional Comments?).

关于最佳方式的任何想法?

Any ideas on the best way?

PS - 我知道,我知道。

PS - I know, I know.

正确答案

#1

这是我最终解决的问题。它适用于IE7,IE8,IE9,FF3.5,FF4,Safari和Chrome。

Here's the solution I ended up with. It works with IE7, IE8, IE9, FF3.5, FF4, Safari and Chrome.

<audio   autoplay="autoplay">
  <source src="https://www.it1352.com/static/audio/clip.ogg" type="audio/ogg" />
  <source src="https://www.it1352.com/static/audio/clip.mp3" type="audio/mpeg" />
</audio> 

<!--[if (!IE)|(gte IE 9)]>
<a href="https://www.it1352.com/1023358.html" onclick="document.getElementById('background_audio').muted = true; return false">mute sound</a>
<![endif]-->

<!--[if lt IE 9]>
<bgsound   src="https://www.it1352.com/static/audio/clip.mp3" autostart="true" loop="1">
<a href="https://www.it1352.com/1023358.html" onclick="document.all['background_snd'].src='https://www.it1352.com/1023358.html'; return false">mute sound</a>
<![endif]--> 

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhchabee
系列文章
更多 icon
同类精品
更多 icon
继续加载