オーディオタグの状態をモニターし、再生と一時停止します.
3604 ワード
watchMusicState(){
let _this = this;
let $audio = document.getElementsByTagName('audio')[0];// DOM
let playOrPause = document.getElementsByClassName('playOrPause')[0];
// console.log($audio);
$audio.addEventListener("playing", function(){
// Doing
_this.playState = true;//
console.log(' ')
});
$audio.addEventListener("pause", function(){
// Doing
_this.playState = false;//
console.log(' ')
});
}