componentDidMount()引用jPlayer不能播放音樂。
componentDidMount(){
$('#player').jPlayer({
ready:function () {
$(this).jPlayer('setMedia',{
mp3:"http://oj4t8z2d5.bkt.clouddn.com/%E9%AD%94%E9%AC%BC%E4%B8%AD%E7%9A%84%E5%A4%A9%E4%BD%BF.mp3"
}).jPlayer('play');
},
supplied:'mp3',
wmode:'window'
})
$('#player').bind($.jPlayer.event.timeupdate,e=>{
this.setState({
progress:Math.round(e.jPlayer.status.currentTime)
});
})
}
運(yùn)行的時(shí)候,顯示正常,秒數(shù)獲取也正常,就是沒有音樂。編譯的時(shí)候沒有warning和error,瀏覽器的控制臺(tái)也沒有報(bào)錯(cuò)。
是我引用的方式不對(duì)?還是有新的規(guī)則呢?
有人可以幫我解答一下嗎?