效果演示
主要源码如下
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="vertical" paddingLeft="0" paddingBottom="0" paddingTop="0" paddingRight="0">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:VideoDisplay width="100%" height="100%" id="player" source="../video.flv" autoPlay="false"/>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="5" verticalAlign="middle">
<mx:Button icon="{assets.Assets.Stop}" width="24" height="24" click="player.stop()"/>
<mx:Button icon="{player.playing?assets.Assets.Pause:assets.Assets.Play}" width="24" height="24" click="playPauseBtnClicked(event)"/>
<mx:HSlider width="100%" showDataTip="false" minimum="0" maximum="{player.totalTime}" value="@{player.playheadTime}"/>
<mx:Button icon="{assets.Assets.Fullscreen}" width="24" height="24" click="fullscreenBtnClicked(event)"/>
</mx:HBox>
<fx:Script>
<![CDATA[
import assets.Assets;
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import flash.events.MouseEvent;
private function fullscreenBtnClicked(param0:MouseEvent):void
{
stage.displayState = stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE ? StageDisplayState.NORMAL : StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
private function playPauseBtnClicked(param0:MouseEvent):void
{
if (player.playing)
{
player.pause();
}
else
{
player.play();
}
}
]]>
</fx:Script>
</mx:Application>