<audio> element not working at all in Safari

后端 未结 2 414
孤街浪徒
孤街浪徒 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条回答
  •  Happy的楠姐
    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

提交回复
热议问题