From 5a70497e2e507255c596b9ead5315bf72f9e0fa9 Mon Sep 17 00:00:00 2001 From: Justin D'Arcangelo Date: Thu, 19 Nov 2015 14:38:57 -0500 Subject: [PATCH] Bug 1222387 - [music] Fast-seeking to the end of the song doesn't correctly start next song --- apps/music/js/endpoint.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/music/js/endpoint.js b/apps/music/js/endpoint.js index 22f4db4be202..0f9e493b347b 100644 --- a/apps/music/js/endpoint.js +++ b/apps/music/js/endpoint.js @@ -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); }); @@ -164,7 +177,7 @@ function seek(time) { return; } - audio.fastSeek(parseInt(time, 10)); + audio.currentTime = parseInt(time, 10); } function startFastSeek(reverse) {