Last active
December 11, 2015 02:38
-
-
Save darkredz/4531702 to your computer and use it in GitHub Desktop.
Full size video player using UIWebView ANE
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
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