diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/media9/players/VPlayer.mxml')
-rw-r--r-- | Master/texmf-dist/source/latex/media9/players/VPlayer.mxml | 81 |
1 files changed, 58 insertions, 23 deletions
diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml index 7d73ce43b7d..d3ef5e17fad 100644 --- a/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml @@ -4,7 +4,7 @@ <!-- a FlashPlayer-10 compatible component for playing --> <!-- FLV and MP4/H.264 video files and streams. --> <!-- --> -<!-- version 20140625 --> +<!-- version 20150511 --> <!-- --> <!-- --> <!-- The free Apache Flex 4 SDK is required to compile --> @@ -40,12 +40,12 @@ xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" preinitialize="initialise(FlexGlobals.topLevelApplication.parameters);" - creationComplete="init();" + applicationComplete="initApp();" backgroundAlpha="0" > <fx:Script> <![CDATA[ - [Bindable] private var scaleMode:String='stretch'; + [Bindable] private var scaleMode:String='letterbox'; [Bindable] private var source:String; [Bindable] private var autoPlay:Boolean=false; [Bindable] private var autoRewind:Boolean=false; @@ -249,8 +249,7 @@ return vidDisp.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); @@ -267,37 +266,73 @@ ExternalInterface.addCallback("duration", duration); ExternalInterface.addCallback("playing", playing); ExternalInterface.addCallback("muted", muted); + + 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();vidDisp.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{vidDisp.pause(); + vidDisp.seek(vidDisp.duration-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=(vidDisp.muted ? "Unmute" : "Mute")+", [m]";} + ); } ]]> </fx:Script> <fx:Declarations> - <s:Fade id="fadeEffect" target="{playProgress}" alphaFrom="0.5" alphaTo="0" duration="2000"/> + <s:Fade id="fadeEffect" target="{playProgress}" alphaFrom="0.5" alphaTo="0" + duration="2000"/> </fx:Declarations> <s:VideoDisplay - id="vidDisp" - width="100%" height="100%" scaleMode="{scaleMode}" - source="{source}" volume="{vol}" - autoPlay="{autoPlay}" autoRewind="{autoRewind}" loop="{loop}" - mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}this.setFocus();" - mouseUp="if(vidComplete) vidDisp.seek(0);if(!stepping){vidDisp.play();}" - mediaPlayerStateChange="onStateChange(event);" - complete="vidComplete=true;" - durationChange="vidDisp.seek(0);" - currentTimeChange="onCurrentTimeChange(event);" + id="vidDisp" + width="100%" height="100%" scaleMode="{scaleMode}" + source="{source}" volume="{vol}" + autoPlay="{autoPlay}" autoRewind="{autoRewind}" loop="{loop}" + mediaPlayerStateChange="onStateChange(event);" + complete="vidComplete=true;" + durationChange="vidDisp.seek(0);" + currentTimeChange="onCurrentTimeChange(event);" /> <mx:ProgressBar width="100%" mode="polled" source="vidDisp" - horizontalCenter="0" bottom="0" labelPlacement="center" - id="loadingProgress" alpha="0.5" - complete="loadingProgress.visible=false;" - progress="onProgress(event)" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="loadingProgress" alpha="0.5" + complete="loadingProgress.visible=false;" + progress="onProgress(event)" /> <mx:ProgressBar width="100%" mode="manual" - horizontalCenter="0" bottom="0" labelPlacement="center" - id="playProgress" alpha="0.5" - visible="false" + horizontalCenter="0" bottom="0" labelPlacement="center" + id="playProgress" alpha="0.5" + visible="false" + /> + + <s:Button alpha="0" width="100%" height="100%" + mouseDown="if(stepping){vidDisp.play();}else{vidDisp.pause();}" + mouseUp="if(vidComplete) vidDisp.seek(0);if(!stepping){vidDisp.play();}" /> </s:Application> |