You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
2.1 KiB

<?xml version="1.0" encoding="utf-8"?>
<s: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"
minWidth="500" minHeight="350" creationComplete="init()">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.core.FlexGlobals;
import flash.display.StageDisplayState;
import mx.managers.SystemManager;
private var streamer:String;
private var file:String;
private function playButtonListener(event:MouseEvent):void {
if(playButton.label == 'Play') {
playButton.label = 'Stop';
videoDisplay.source = streamer + "/" + file;
videoDisplay.play();
} else {
playButton.label = 'Play';
videoDisplay.source = "";
//videoDisplay.close();
}
}
private function fullscreenButtonListener(event:MouseEvent):void {
try {
switch (systemManager.stage.displayState) {
case StageDisplayState.FULL_SCREEN:
stage.displayState = StageDisplayState.NORMAL;
break;
default:
stage.displayState = StageDisplayState.FULL_SCREEN;
break;
}
} catch (err:SecurityError) {
// ignore
}
}
private function init():void {
videoDisplay.mx_internal::videoPlayer.bufferTime = 1;
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
if(streamer == null) {
Alert.show('Missing flashvars: streamer');
return;
}
file = FlexGlobals.topLevelApplication.parameters.file;
if(file == null) {
Alert.show('Missing flashvars: file');
return;
}
playButton.addEventListener(MouseEvent.CLICK, playButtonListener);
fullscreenButton.addEventListener(MouseEvent.CLICK, fullscreenButtonListener);
}
]]>
</fx:Script>
<s:BorderContainer x="0" y="0" width="100%" height="100%">
<s:VideoDisplay width="100%" height="100%" id="videoDisplay"></s:VideoDisplay>
<s:Button label="Play" id="playButton" horizontalCenter="0" bottom="10"></s:Button>
<s:Button label="[ ]" id="fullscreenButton" right="10" bottom="10"></s:Button>
</s:BorderContainer>
</s:Application>