From 65833f5231fc99ad39442d495ce2fd7939f1c6ba Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Fri, 25 Apr 2014 13:14:03 -0700 Subject: [PATCH] Making sure a tech exists when starting manual progress and timeupdate events --- src/js/player.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/js/player.js b/src/js/player.js index 40f5797050..8d7ed8a4d7 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -322,14 +322,16 @@ vjs.Player.prototype.manualProgressOn = function(){ // In HTML5, some older versions don't support the progress event // So we're assuming they don't, and turning off manual progress if they do. // As opposed to doing user agent detection - this.tech.one('progress', function(){ + if (this.tech) { + this.tech.one('progress', function(){ - // Update known progress support for this playback technology - this.features['progressEvents'] = true; + // Update known progress support for this playback technology + this.features['progressEvents'] = true; - // Turn off manual progress tracking - this.player_.manualProgressOff(); - }); + // Turn off manual progress tracking + this.player_.manualProgressOff(); + }); + } }; vjs.Player.prototype.manualProgressOff = function(){ @@ -362,12 +364,14 @@ vjs.Player.prototype.manualTimeUpdatesOn = function(){ // timeupdate is also called by .currentTime whenever current time is set // Watch for native timeupdate event - this.tech.one('timeupdate', function(){ - // Update known progress support for this playback technology - this.features['timeupdateEvents'] = true; - // Turn off manual progress tracking - this.player_.manualTimeUpdatesOff(); - }); + if (this.tech) { + this.tech.one('timeupdate', function(){ + // Update known progress support for this playback technology + this.features['timeupdateEvents'] = true; + // Turn off manual progress tracking + this.player_.manualTimeUpdatesOff(); + }); + } }; vjs.Player.prototype.manualTimeUpdatesOff = function(){