From acf08ecd4cca72432e60c26cfa7aa0fc3f61dd95 Mon Sep 17 00:00:00 2001 From: stevenaw Date: Wed, 16 Mar 2011 07:18:50 -0400 Subject: [PATCH] [#280] Ported to Flash Player --- players/vimeo/popcorn.vimeo.html | 2 +- players/vimeo/popcorn.vimeo.js | 105 ++++++++++++++++++------------- 2 files changed, 64 insertions(+), 43 deletions(-) diff --git a/players/vimeo/popcorn.vimeo.html b/players/vimeo/popcorn.vimeo.html index 60d0c01..719e81b 100644 --- a/players/vimeo/popcorn.vimeo.html +++ b/players/vimeo/popcorn.vimeo.html @@ -131,7 +131,7 @@ Footnote Area
- +


diff --git a/players/vimeo/popcorn.vimeo.js b/players/vimeo/popcorn.vimeo.js index e13b1ff..f372d41 100644 --- a/players/vimeo/popcorn.vimeo.js +++ b/players/vimeo/popcorn.vimeo.js @@ -1,4 +1,6 @@ // Popcorn Vimeo Player Wrapper +var onVimeoLoad; + ( function( Popcorn ) { /** * Vimeo wrapper for Popcorn. @@ -177,19 +179,26 @@ Popcorn.vimeo.init = (function() { var rPlayerUri = /^http:\/\/player\.vimeo\.com\/video\/[\d]+/i, rWebUrl = /vimeo\.com\/[\d]+/, - registry = [], + registry = {}, hasAPILoaded = false; + onVimeoLoad = function( playerId ) { + var player = registry[ playerId ]; + + player.swfObj = document.getElementById( playerId ); + player.dispatchEvent( "load" ); + } + // Source file is from https://github.com/vimeo/froogaloop/blob/master/froogaloop.min.js // HTTPS seems to have some difficulties with getScript, so store locally - Popcorn.getScript( "./froogaloop.min.js", function() { + Popcorn.getScript( "./swfobject.js", function() { var i, l = registry.length; hasAPILoaded = true; - for( i=0; i 1.0, Vimeo expects 0-100 this.volume = this.previousVolume = val; - this.swfObj.api( "api_setVolume", val*100 ); + this.swfObj.api_setVolume( val*100 ); this.evtHolder.dispatchEvent( "volumechange" ); }, // Seeks the video @@ -393,7 +414,7 @@ this.currentTime = this.previousCurrentTime = time; this.ended = time >= this.duration; - this.swfObj.api( "api_seekTo", time ); + this.swfObj.api_seekTo( time ); // Fire events for seeking and time change this.evtHolder.dispatchEvent( "seeked" ); @@ -407,11 +428,11 @@ } this.evtHolder.dispatchEvent( "play" ); - this.swfObj.api( "api_play" ); + this.swfObj.api_play(); }, // Pauses the video pause: function() { - this.swfObj.api( "api_pause" ); + this.swfObj.api_pause(); }, mute: function() { if ( !this.muted() ) { @@ -441,7 +462,7 @@ unload: function() { this.pause(); - this.swfObj.api( "api_unload" ); + this.swfObj.api_unload(); this.evtHolder.dispatchEvent( "abort" ); this.evtHolder.dispatchEvent( "emptied" ); }, @@ -465,7 +486,7 @@ playerEvt = "onFinish"; } else if ( evt === "playing" ) { playerEvt = "onPlay"; - } else if ( evt === "pause" || evt === "load" ) { + } else if ( evt === "pause" ) { // Direct mapping, CamelCase the event name as vimeo API expects playerEvt = "on"+evt[0].toUpperCase() + evt.substr(1); } @@ -477,7 +498,7 @@ // Link manual event structure with Vimeo's if not already // Do not link for 'timeupdate' if( evt !== "timeupdate" && playerEvt && this.evtHolder.getEventListeners( evt ).length === 1 ) { - this.swfObj.addEvent( playerEvt, function() { + this.swfObj.api_addEventListener( playerEvt, function() { that.evtHolder.dispatchEvent( evt ); }); } -- 2.43.0