Skip to content

Commit

Permalink
Ensure videos resume if preload="none". Fixes #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-p committed Nov 12, 2013
1 parent c9a5a21 commit fc9c44e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion video-quality-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
_V_.ResolutionMenuItem.prototype.onClick = function() {

var player = this.player(),
video_el = player.el().firstChild,
current_time = player.currentTime(),
is_paused = player.paused(),
button_nodes = player.controlBar.resolutionSelector.el().firstChild.children,
Expand All @@ -108,7 +109,10 @@
// Do nothing if we aren't changing resolutions
if ( player.getCurrentRes() == this.resolution ) { return; }

// Change the source and make sure we don't start the video over
// Make sure the loadedmetadata event will fire
if ( 'none' == video_el.preload ) { video_el.preload = 'metadata'; }

// Change the source and make sure we don't start the video over
player.src( player.availableRes[this.resolution] ).one( 'loadedmetadata', function() {

player.currentTime( current_time );
Expand Down

0 comments on commit fc9c44e

Please sign in to comment.