0
我正在嘗試使用jPlayer在服務上播放背景音樂。jPlayer播放下一個文件
這裏是我的代碼:
if (command.indexOf('playmusic') != -1) {
var player = document.getElementById('jpId');
$(player).jPlayer(
{
ready: function() {
$(this).jPlayer("setMedia", {
mp3: "../../audio/1.mp3"
}).jPlayer("play");
}, supplied: "mp3"
}
);
}
if (command.indexOf('playnext') != -1) {
var player = document.getElementById('jpId');
$(player).setFile("../../audio/2.mp3");
$(player).play();
}
但代碼playnext部分不工作:
Uncaught TypeError: Object [object Object] has no method 'setFile'
我做錯了嗎?
Thanx!