nginx-mod-rtmp/test/rtmp-publisher/RtmpPlayer.mxml

70 lines
2.1 KiB
Plaintext
Raw Normal View History

2012-08-16 11:08:24 +02:00
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
2013-07-25 23:29:05 +02:00
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="500" minHeight="350" creationComplete="init()">
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.core.FlexGlobals;
import flash.display.StageDisplayState;
import mx.managers.SystemManager;
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
private var streamer:String;
private var file:String;
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
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();
2013-07-25 23:29:05 +02:00
}
}
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
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
}
}
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
private function init():void {
2013-08-22 14:17:12 +02:00
videoDisplay.mx_internal::videoPlayer.bufferTime = 1;
2013-07-25 23:29:05 +02:00
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
if(streamer == null) {
Alert.show('Missing flashvars: streamer');
return;
}
2012-08-16 11:08:24 +02:00
2013-07-25 23:29:05 +02:00
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>
2013-07-25 23:29:05 +02:00
<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>
2012-08-16 11:08:24 +02:00
</s:Application>