开发者

HTML5 <audio> differing behavior on Chrome Mac/Win and Safari Mac/Win

I'm inserting an <开发者_StackOverflow中文版;audio> tag into a page. This works fine in Chrome and Safari on Mac, but on both Chrome and Safari in Windows the tag is inserted but the audio never plays. I've stripped the code down to the minimum, and it's now ridiculously simple. I just have no idea why Windows is being difficult.

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>
            test
        </title>
        <script type="application/x-javascript" src="js/jquery-1.4.2.min.js" charset="utf-8"></script>
    </head>
    <body>
        <script type="application/x-javascript">
        $('body').html('<audio src="./audio/myfile.mp3" autoplay></audio>');
        </script>
    </body>
</html>

Interestingly, if I remove all JS and just insert the <audio> tag into the <body>, Chrome Win works but Safari Win still doesn't. Kind of a secondary question, but does Safari Win require QuickTime (not currently installed) in order to use the <audio> tag?


does Safari Win require QuickTime (not currently installed) in order to use the tag

Yes it does.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜