Skip to content

Commit

Permalink
refaxctor(player): naming #7
Browse files Browse the repository at this point in the history
  • Loading branch information
rudywaltz committed Apr 5, 2019
1 parent 77357e4 commit 2a9a3e2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/Player.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3 class="player__url">{ $song.url ? $song.url : 'No sound selected' }</h3>
duration: 0,
time: 0,
playing: false,
pollingSong: false,
clearPollingSong: false,
volume: .5
}
},
Expand All @@ -60,7 +60,7 @@ <h3 class="player__url">{ $song.url ? $song.url : 'No sound selected' }</h3>
}
},
onend: () => {
this.set({ pollingSong: true });
this.set({ clearPollingSong: true });
const { playlist } = this.store.get();
if (playlist.length) {
loadNewSong({}, playlist);
Expand Down Expand Up @@ -113,15 +113,16 @@ <h3 class="player__url">{ $song.url ? $song.url : 'No sound selected' }</h3>
playSound: function() {
this.currentSound.play();
this.set({ playing: true });
this.set({ pollingSong: false });
this.set({ clearPollingSong: false });

const pollingSongData = setInterval(() => {
if (this.get().pollingSong) {
if (this.get().clearPollingSong) {
this.set({time: 0 });
clearInterval(pollingSongData);
} else {
this.set({time: this.currentSound.seek()});
return;
}

this.set({time: this.currentSound.seek()});
}, 200);
},

Expand Down

0 comments on commit 2a9a3e2

Please sign in to comment.