0
function audio(path2audio){
var mySound = new buzz.sound (path2audio, {
formats: ["mp3"],
preload: false,
autoplay: false,
loop: false,
volume: 70,
});
mySound.play();
}
http://buzz.jaysalvat.com/documentation/sound/
Well, I need to make a trigger called outside this function in order to stop the audio file to stop playing. My difficulty is that whenever I call the method outside the function, it shows an error: "main.js:40 Uncaught TypeError: Cannot read property 'bind' of undefined".
mySound.bind('playing', function() {
mySound.stop();
});
有人可以帮我解决这个问题吗?如何与功能范围外的buzz.sound函数进行交互?
在我的情况下,我还不得不在jQuery的'$(document).ready(function(){')之外声明一个全局变量。 – Roger