音乐不能播放
我是通过cdn的方式引入的,控制台也没有报错,然后就是播放不了,请问这是为什么?
import React from 'react';
import Header from 'src/components/header/header';
import Progress from 'src/components/progress/progress';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
progress: '-'
};
};
componentDidMount() {
console.log($('#player'));
$('#player').jPlayer({
ready: function () {
$(this).jPlayer('setMedia', {
mp3: 'http://m10.music.126.net/20170829152420/0c3dd98e5f546e3e21c52afccf10ed0c/ymusic/39bf/7396/8331/ee81049345e13a18e044059d6551640a.mp3'
}).jPlayer('play');
},
supplied: 'mp3',
wmode: 'window'
});
$('jPlayer').bind($.jPlayer.event.timeupdate, (e) => {
console.log(1);
this.setState({
progress: Math.round(e.jPlayer.status.currentTime)
});
});
}
render() {
return (
<div className="app">
<Header/>
<Progress progress={this.state.progress}></Progress>
</div>
);
};
};
export default App;