Skip to content
Permalink
Browse files

Merge pull request #29719 from davidflanagan/bug1150322

Bug 1150322 - make the seek bar behave a little better for songs of infi... r=squib,dkuo
  • Loading branch information...
davidflanagan committed Apr 30, 2015
2 parents ef9afb0 + ddc3468 commit b813864f8365322ff7efded51ea768c4474b1d4c
Showing with 5 additions and 18 deletions.
  1. +5 −18 apps/music/js/ui/views/player_view.js
@@ -763,27 +763,14 @@ var PlayerView = {
this.audio.currentTime = Math.floor(seekTime);
}

var startTime = this.audio.startTime;

var endTime;
// The audio element's duration might be NaN or 'Infinity' if it's not ready
// We should get the duration from the buffered parts before the duration
// is ready, and be sure to get the buffered parts if there is data in it.
if (isNaN(this.audio.duration)) {
endTime = 0;
} else if (this.audio.duration === Infinity) {
endTime = (this.audio.buffered.length > 0) ?
this.audio.buffered.end(this.audio.buffered.length - 1) : 0;
} else {
endTime = this.audio.duration;
}

var currentTime = this.audio.currentTime;

this.setSeekBar(startTime, endTime, currentTime);
this.setSeekBar(0, this.audio.duration, this.audio.currentTime);
},

setSeekBar: function pv_setSeekBar(startTime, endTime, currentTime) {
if (!isFinite(endTime)) {
endTime = Math.max(this.seekBar.max, currentTime);
}

if (this.seekBar.max != endTime) {
// Duration changed, update accessibility label.
navigator.mozL10n.setAttributes(this.seekSlider,

0 comments on commit b813864

Please sign in to comment.
You can’t perform that action at this time.