diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml')
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml index 02c684ffe32..7d748112a95 100644 --- a/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml @@ -4,7 +4,7 @@ <!-- a FlashPlayer-9 compatible component for playing --> <!-- FLV and MP4/H.264 video files and streams. --> <!-- --> -<!-- version 20140625 --> +<!-- version 20150511 --> <!-- --> <!-- Copyright (C) 2012-today Alexander Grahn --> <!-- --> @@ -25,7 +25,7 @@ <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" preinitialize="initialise(Application.application.parameters);" - creationComplete="init();" + applicationComplete="initApp();" backgroundAlpha="0" paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0" @@ -38,7 +38,7 @@ [Bindable] private var loop:Boolean=false; [Bindable] private var vol:Number=0.75; [Bindable] private var stepping:Boolean=false; - [Bindable] private var letterbox:Boolean=false; + [Bindable] private var keepAspect:Boolean=true; private var vidComplete:Boolean=false; private var deltaSeek:Number; private var playheadTime:Number; @@ -52,11 +52,11 @@ import flash.external.*; private function initialise(flashVars:Object):void { source=flashVars.source; - if(flashVars.autoPlay=='true'){autoPlay=true} - if(flashVars.loop=='true'){loop=true} - if(flashVars.volume){vol=Number(flashVars.volume)} - if(flashVars.stepping){stepping=flashVars.stepping} - if(flashVars.scaleMode=='letterbox'){letterbox=true} + if(flashVars.autoPlay=='true') autoPlay=true; + if(flashVars.loop=='true') loop=true; + if(flashVars.volume) vol=Number(flashVars.volume); + if(flashVars.stepping) stepping=flashVars.stepping; + if(flashVars.scaleMode && flashVars.scaleMode!='letterbox') keepAspect=false; } private function onProgress(event:ProgressEvent):void { @@ -239,8 +239,7 @@ return muted; } - private function init():void { - this.setFocus(); + private function initApp():void { this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); this.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); this.addEventListener(Event.ENTER_FRAME, onEnterFrame); @@ -257,6 +256,39 @@ ExternalInterface.addCallback("duration", duration); ExternalInterface.addCallback("playing", playing); ExternalInterface.addCallback("muted", ismuted); + + var itemPlayPause:ContextMenuItem = new ContextMenuItem("N.N."); + this.contextMenu.customItems.push(itemPlayPause); + itemPlayPause.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, + function(e:ContextMenuEvent):void{playPause();}); + + var itemRewind:ContextMenuItem = new ContextMenuItem("Rewind, [Home]"); + this.contextMenu.customItems.push(itemRewind); + itemRewind.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, + function(e:ContextMenuEvent):void{vidDisp.pause();seek(0);}); + + var itemGotoEnd:ContextMenuItem = new ContextMenuItem("Goto End, [End]"); + this.contextMenu.customItems.push(itemGotoEnd); + itemGotoEnd.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, + function(e:ContextMenuEvent):void{if(vidDisp.bytesTotal){ + vidDisp.pause(); + vidDisp.playheadTime=vidDisp.totalTime-0.1;}}); + + var itemMute:ContextMenuItem = new ContextMenuItem("N.N."); + this.contextMenu.customItems.push(itemMute); + itemMute.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, + function(e:ContextMenuEvent):void{mute();}); + + this.contextMenu.customItems.push( + new ContextMenuItem("Seek, [\u2190]/[\u2192]", true, false, true)); + this.contextMenu.customItems.push( + new ContextMenuItem("Volume, [\u2191]/[\u2193]", false, false, true)); + + this.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, + function(e:ContextMenuEvent):void{ + itemPlayPause.caption=(vidDisp.playing ? "Pause" : "Play")+", [Space]"; + itemMute.caption=(muted ? "Unmute" : "Mute")+", [m]";} + ); } ]]> </mx:Script> @@ -267,12 +299,10 @@ <mx:VideoDisplay id="vidDisp" - width="100%" height="100%" maintainAspectRatio="{letterbox}" + width="100%" height="100%" maintainAspectRatio="{keepAspect}" backgroundAlpha="0" borderThickness="0" source="{source}" volume="{vol}" autoPlay="{autoPlay}" autoRewind="{loop}" - mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}this.setFocus();" - mouseUp="if(vidComplete) vidDisp.playheadTime=0;if(!stepping){vidDisp.play();}" stateChange="onStateChange(event);" complete="vidComplete=true;" rewind="vidDisp.play();" @@ -291,4 +321,10 @@ id="playProgress" alpha="0.5" visible="false" /> + + <mx:Button alpha="0" width="100%" height="100%" cornerRadius="0" + paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0" + mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}" + mouseUp="if(vidComplete) vidDisp.playheadTime=0;if(!stepping){vidDisp.play();}" + /> </mx:Application> |