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