diff --git a/modules/player/popcorn.player.js b/modules/player/popcorn.player.js index 1e130903..15d93df7 100644 --- a/modules/player/popcorn.player.js +++ b/modules/player/popcorn.player.js @@ -321,11 +321,8 @@ Popcorn.player.registry = {}; - Popcorn.player.defineProperty = Object.defineProperty || function( object, description, options ) { - - object.__defineGetter__( description, options.get || Popcorn.nop ); - object.__defineSetter__( description, options.set || Popcorn.nop ); - }; + // legacy support for Popcorn.player.defineProperty + Popcorn.player.defineProperty = Popcorn.defineProperty; // smart will attempt to find you a match, if it does not find a match, // it will attempt to create a video element with the source, diff --git a/popcorn.js b/popcorn.js index 85797468..f683b37e 100644 --- a/popcorn.js +++ b/popcorn.js @@ -288,17 +288,12 @@ } }; - var error = function() { + Popcorn.defineProperty( this, "error", { + get: function() { - self.media.removeEventListener( "error", error, false ); - self.error = self.media.error; - }; - - // grab the error object if it already exists - this.error = this.media.error; - - // listen for future errors and report on to the error object - this.media.addEventListener( "error", error, false ); + return self.media.error; + } + }); if ( self.media.readyState >= 2 ) { @@ -346,6 +341,12 @@ return obj; }; + Popcorn.defineProperty = Object.defineProperty || function( object, description, options ) { + + object.__defineGetter__( description, options.get || Popcorn.nop ); + object.__defineSetter__( description, options.set || Popcorn.nop ); + }; + Popcorn.extend = function( obj ) { var dest = obj, src = slice.call( arguments, 1 );