Added sync check to song player.

This commit is contained in:
Harrison Deng 2022-04-17 01:30:21 -05:00
parent ab1871bb8e
commit 0543efccd8
2 changed files with 3 additions and 4 deletions

View File

@ -51,7 +51,7 @@ export default class PlayListSong {
this._audio.addEventListener("canplaythrough", () => {
this.ready = true;
if (onReady) {
if (onReady && this.isAudioInstantiated()) {
onReady(this._audio);
}
});

View File

@ -105,7 +105,6 @@ export default class SongPlayer {
playCurrent() {
this.getCurrentSong().getAudio((audio) => {
// TODO: May need to perform synchronization check to see if this is still the song to be played.
audio.volume = this._volume;
audio.play();
});
@ -232,8 +231,8 @@ export default class SongPlayer {
/**
* @callback changeListener
* @param {any} old the previous value.
* @param {any} current the the current (new) value.
* @param {*} old the previous value.
* @param {*} current the the current (new) value.
*/
/**