<audio> element not working at all in Safari

后端 未结 2 392
孤街浪徒
孤街浪徒 2021-01-22 17:29

I\'m trying to add music to a virtual tour application I\'m writing in JS and jQuery and so far my code, shown below, works great in Chrome, FF, IE9, and Opera. But in Safari 5

相关标签:
2条回答
  • 2021-01-22 18:00

    In HTML5 video on Safari I had an issue with this where I had to "load" (which, I think, either starts the buffer or loads the whole thing) before I set it to play. This seemed to actually make things work in a few webkit browsers. So something like:

    var a = new Audio("file.mp3");
    a.load();
    a.play();
    

    Worth a try

    0 讨论(0)
  • 2021-01-22 18:15

    So the problem turned out to be with QuickTime. I guess I must of deleted it off of my machine awhile back because I didn't think I needed it. After I re-installed QuickTime, Safari plays music using the audio tag with no problem. Autoplay even works too.

    Kinda funny how the champion of native HTML5 audio/video support, doesn't support HTML5 audio/video without a plugin...

    0 讨论(0)
提交回复
热议问题