Skip to content

Instantly share code, notes, and snippets.

@darkredz
Last active December 11, 2015 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkredz/4531702 to your computer and use it in GitHub Desktop.
Save darkredz/4531702 to your computer and use it in GitHub Desktop.
Full size video player using UIWebView ANE
protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
if(fsVideo) return;
fsVideo = new VideoPlayer(stage, new Rectangle(0,0,stage.stageWidth, stage.stageHeight));
//this will auto play and enter full screen mode
fsVideo.initAndLoad("videos/IKH5zGaSIfs_c.mp4","video/mp4",true,false,false,false);
//make video player fullsize (width and height covers full stage size)
fsVideo.makeFullSizePlayer();
fsVideo.addEventListener(VideoPlayerEvent.PLAYER_CREATED, onHtmlDone);
fsVideo.addEventListener(UIWebViewEvent.JS_TRIGGER_AS3, onJSTrigger);
}
protected function onHtmlDone(event:VideoPlayerEvent):void
{
fsVideo.setOverlayHtml('<div class="mybutton" onclick="triggerAS3(\'exitPage\')">Back</div>');
fsVideo.play();
}
protected function onJSTrigger(event:UIWebViewEvent):void
{
if(event.functionName=='exitPage'){
//when user exit player fullscreen, pop the view
fsVideo.dispose();
navigator.popView();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment