Last active
August 29, 2015 14:24
-
-
Save sydseter/a75b2724a10a7b78305f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PluginVO.player.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_PLAY_CHANGE, handleCanPlay); | |
stage.addEventListener("success", VPLoadSuccess); | |
stage.addEventListener("CustomControlbar", connectedToVp); | |
/** | |
* Inform the ad player in case this hasn't been done already | |
*/ | |
handleCanPlay(e):void | |
{ | |
var delay:Timer = new Timer(500, 0); | |
delay.addEventListener(TimerEvent.TIMER, function (e:TimerEvent):void{ | |
e.target.stop(); | |
if (PluginVO.plugin == null) { | |
trace("[se.adoreyou.customControlbarPlugin] [WARN] CustomControlbar Plugin not initalized, could not dispatch the controlbar to Videoplaza."); | |
return; | |
} | |
trace("[se.adoreyou.customControlbarPlugin] [WARN] Videoplaza success event has not been dispatched to the CustomControlbar. Forcing Videoplaza success"); | |
PluginVO.stage.dispatchEvent(new ControlBarEvent("success", "success")); | |
}); | |
delay.start(); | |
} | |
/** | |
Handles successfull loading of adplayer and dispatches event containing reference to plugin instance. | |
*/ | |
VPLoadSuccess(e):void | |
{ | |
this.vpLoaded = true; | |
if (!this.vpConnected) { | |
PluginVO.resource.addMetadataValue("ControlBarPlugin", PluginVO.plugin); | |
PluginVO.stage.dispatchEvent(new ControlBarEvent("CustomControlbar", PluginVO.plugin)); | |
trace("[se.adoreyou.customControlbarPlugin] [INFO] CustomControlbar Videoplaza ad player has been loaded"); | |
} | |
} | |
connectedToVp(event):void | |
{ | |
this.vpConnected = true; | |
trace("[se.adoreyou.customControlbarPlugin] [INFO] CustomControlbar Custom Controlbar Plugin connected to Videoplaza ad player"); | |
if (PluginVO.autoPlay) { | |
PluginVO.controlBarContainer.dispatchEvent(new ControlBarEvent(ControlBarEvent.PLAYBACK_STATE_CHANGE, 'play')); | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment