Skip to content

Commit 6e1c816

Browse files
committed
fix player when try to activate a track on a empty view, also fixes when paused and it's a different view
1 parent 8dcf617 commit 6e1c816

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

app/public/js/common/playerService.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,17 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
6262
function deactivateCurrentSong() {
6363
var currentSong = getCurrentSong();
6464

65-
if ( ! currentSong ) {
66-
return false;
65+
if ( currentSong ) {
66+
currentSong.classList.remove('currentSong');
6767
}
68-
69-
currentSong.classList.remove('currentSong');
7068
}
7169

7270
function activateCurrentSong(trackId) {
7371
var el = document.querySelector('span[data-song-id="' + trackId + '"]');
74-
el.classList.add('currentSong');
72+
73+
if ( el ) {
74+
el.classList.add('currentSong');
75+
}
7576
}
7677

7778
/**
@@ -200,10 +201,8 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
200201
* @method playSong
201202
*/
202203
player.playSong = function() {
203-
if ( getCurrentSong() ) {
204-
this.elPlayer.play();
205-
$rootScope.isSongPlaying = true;
206-
}
204+
this.elPlayer.play();
205+
$rootScope.isSongPlaying = true;
207206
};
208207

209208
/**

0 commit comments

Comments
 (0)