/** * Play's the Audio Player if nessesary. */ play() { if (this.audioPlayer.paused) { this.audioPlayer.play().then(() => { console.log('Assistant Audio is playing...'); }).catch(e => console.log('something went wrong starting the player...', e)); } }
controls.play.addEventListener("click", () => { if (!playlist.active) controls.next.click(); else if (player.paused) player.play(); else player.pause(); });
resume(){ if (this.audio.src){ this.playing = true; if(this.audio.paused){ this.audio.play(); if(this.resumeCb) this.resumeCb(); } return true; } return false; }
get isPaused(){ return this.audio.paused; }
play() { return new Promise((resolve, reject) => { if (this._context.state === 'suspended') { this._context.resume(); this._log('Play audio'); this.emit(Player.EventTypes.PLAY); resolve(); } else if (this._audio && this._audio.paused) { this._log('Play audio'); this.emit(Player.EventTypes.PLAY); this._audio.play(); resolve(); } else { return this.deque() .then(audioBuffer => { this._log('Play audio'); this.emit(Player.EventTypes.PLAY); if (typeof audioBuffer === 'string') { return this.playUrl(audioBuffer); } return this.playAudioBuffer(audioBuffer); }).then(resolve); } }); }
title: "Play/Pause", click() { if (player.paused) player.play(); else player.pause();
if(audioElement.paused) audioElement.play();
controls.play.addEventListener("click", () => { if (!playlist.active) controls.next.click(); else if (player.paused) player.play(); else player.pause(); });
controls.play.addEventListener("click", () => { if (!playlist.active) controls.next.click(); else if (player.paused) player.play(); else player.pause(); });
controls.play.addEventListener("click", () => { if (!playlist.active) controls.next.click(); else if (player.paused) player.play(); else player.pause(); });
title: "Play/Pause", click() { if (player.paused) player.play(); else player.pause();