Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1222387 - [music] Fast-seeking to the end of the song doesn't cor… #33283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/music/js/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ document.addEventListener('DOMContentLoaded', function() {
});

audio.addEventListener('ended', function() {
if (isFastSeeking) {
isFastSeeking = false;
nextSong(true);
}

// Prevent subsequent "ended" events from performing
// multiple skips to the next song. This shouldn't
// happen, but it seems to happen when we are fast-seeking
// and is detectable by checking for a negative time.
if (audio.currentTime < 0) {
return;
}

nextSong(true);
});

Expand Down Expand Up @@ -164,7 +177,7 @@ function seek(time) {
return;
}

audio.fastSeek(parseInt(time, 10));
audio.currentTime = parseInt(time, 10);
}

function startFastSeek(reverse) {
Expand Down