Safari中的音频标签 [英] Audio tag in Safari

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

问题描述

我有以下html:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <style type="text/css">
        html
        {
            height: 100%;
        }
    </style>
    <script language=javascript src="scripts/lib.js"></script>
</head>
<body>
    <audio controls autoplay>
        <source src="track09.wav">
    </audio>
</body>
</html>

它在FF4中有效,但在Winx64下的Safari 5.0.5中没有。我该如何解决?

It does work in FF4, but doesn't in Safari 5.0.5 under Winx64. How should I fix it?

Thx。

更新。 mp3和html文件都是本地的,不存储在服务器端。

UPDATED. Both mp3 and html files are local, not stored on server side.

推荐答案

答案很少编辑。

为源添加类型。我在Safari中测试过。此代码适用于我。

Add type for source. I've tested in Safari. This code works for me.

  <source src="track09.wav" type="audio/x-wav">

另一种解决方案(适用于Safari)是使用AAC编解码器。它在Firefox中不起作用。

The other solution (for Safari) is to use AAC codec. It doesn't work in Firefox.

  <source src="track09.aac" type="audio/aac" />

您可以将Ogg Vorbis用于Firefox。它可能在Safari中不起作用。

You may use Ogg Vorbis for Firefox. It probably doesn't work in Safari.

  <source src="track09.ogg" type="audio/ogg" />

看起来没有任何通用编解码器。您必须对您的声音进行几次编码或不支持少量浏览器。

It looks there isn't any universal codec. You have to encode Your sound few times or don't support few browsers.

P.S。
看起来mp3对我来说无处可行。

P.S. It looks mp3 doesn't work anywhere for me.

这篇关于Safari中的音频标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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