Skip to content

Commit

Permalink
fix: song restarts if now_playing status changes during score
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Jan 3, 2025
1 parent 39fb27b commit f4140a5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pikaraoke/templates/splash.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
var menuButtonVisible = false;
var confirmationDismissed = false;
var volume = 0.85;
var isScoreShown = false;

const scoreReviews = {
low:[
Expand Down Expand Up @@ -86,15 +87,17 @@
$.get('{{ url_for("clear_command") }}');
}

function stopVideo() {
function hideVideo() {
$("#video-container").hide();
}

async function endSong(reason=null, showScore=false) {
stopVideo();
if (showScore && '{{ disable_score }}' == 'False') {
isScoreShown = true;
await startScore("{{ url_for('static', filename='') }}");
isScoreShown = false;
}
hideVideo();
$.post('{{ url_for("end_song") }}', {reason: reason});
}

Expand Down Expand Up @@ -237,7 +240,7 @@
$(video).animate({ volume: 0 }, 1000, () => {
video.pause();
video.volume = obj.volume;
stopVideo();
hideVideo();
});
}

Expand All @@ -248,7 +251,7 @@
video.volume = obj.volume;
});
}
if (obj.now_playing && video.paused && !obj.is_paused) {
if (obj.now_playing && video.paused && !obj.is_paused && !isScoreShown) {
video.play();
video.volume = 0
$(video).animate({ volume: obj.volume }, 1000);
Expand Down

0 comments on commit f4140a5

Please sign in to comment.