Skip to content

Commit 4b42fc2

Browse files
committed
Don't play if no track is queued.
1 parent 5d5a96c commit 4b42fc2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

app/public/js/player/playerCtrl.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ app.controller('PlayerCtrl', function (
4545
};
4646

4747
$scope.playPause = function ($event) {
48-
if ($rootScope.isSongPlaying) {
49-
playerService.pauseSong();
50-
} else {
51-
playerService.playSong();
52-
}
48+
togglePlayPause();
5349
};
5450

5551
$scope.prevSong = function ($event) {
@@ -149,7 +145,9 @@ app.controller('PlayerCtrl', function (
149145
* the amount of times we define it.
150146
*/
151147
var togglePlayPause = function () {
152-
if ($rootScope.isSongPlaying) {
148+
var track = queueService.getTrack();
149+
150+
if ($rootScope.isSongPlaying || track == null) {
153151
playerService.pauseSong();
154152
} else {
155153
playerService.playSong();

0 commit comments

Comments
 (0)