mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-20 09:51:08 +02:00
updated test rtmp publisher and player
This commit is contained in:
parent
b52ebc8534
commit
488c571497
|
@ -1,70 +1,67 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
|
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
|
||||||
xmlns:s="library://ns.adobe.com/flex/spark"
|
xmlns:s="library://ns.adobe.com/flex/spark"
|
||||||
xmlns:mx="library://ns.adobe.com/flex/mx"
|
xmlns:mx="library://ns.adobe.com/flex/mx"
|
||||||
minWidth="500" minHeight="350" creationComplete="init()">
|
minWidth="500" minHeight="350" creationComplete="init()">
|
||||||
|
|
||||||
<fx:Declarations>
|
<fx:Script>
|
||||||
<!-- Place non-visual elements (e.g., services, value objects) here -->
|
<![CDATA[
|
||||||
</fx:Declarations>
|
import mx.controls.Alert;
|
||||||
|
import mx.core.FlexGlobals;
|
||||||
|
import flash.display.StageDisplayState;
|
||||||
|
import mx.managers.SystemManager;
|
||||||
|
|
||||||
<fx:Script>
|
private var streamer:String;
|
||||||
<![CDATA[
|
private var file:String;
|
||||||
import mx.controls.Alert;
|
|
||||||
import mx.core.FlexGlobals;
|
|
||||||
private var streamer:String;
|
|
||||||
private var file:String;
|
|
||||||
|
|
||||||
private function toggleFeedListener(event:MouseEvent):void {
|
private function playButtonListener(event:MouseEvent):void {
|
||||||
if(toggleFeed.label == 'Start Feed') {
|
if(playButton.label == 'Play') {
|
||||||
toggleFeed.label = 'Stop Feed';
|
playButton.label = 'Stop';
|
||||||
toggleAudio.enabled = true;
|
videoDisplay.source = streamer + "/" + file;
|
||||||
videoDisplay.play();
|
videoDisplay.play();
|
||||||
} else {
|
} else {
|
||||||
toggleFeed.label = 'Start Feed';
|
playButton.label = 'Play';
|
||||||
toggleAudio.enabled = false;
|
videoDisplay.source = "";
|
||||||
videoDisplay.close();
|
videoDisplay.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function toggleAudioHandler(event:MouseEvent):void {
|
private function fullscreenButtonListener(event:MouseEvent):void {
|
||||||
if(toggleAudio.label == 'Unmute') {
|
try {
|
||||||
toggleAudio.label = 'Mute';
|
switch (systemManager.stage.displayState) {
|
||||||
videoDisplay.volume = 1;
|
case StageDisplayState.FULL_SCREEN:
|
||||||
} else {
|
stage.displayState = StageDisplayState.NORMAL;
|
||||||
toggleAudio.label = 'Unmute';
|
break;
|
||||||
videoDisplay.volume = 0;
|
default:
|
||||||
}
|
stage.displayState = StageDisplayState.FULL_SCREEN;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
} catch (err:SecurityError) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function initListeners():void {
|
private function init():void {
|
||||||
toggleFeed.addEventListener(MouseEvent.CLICK, toggleFeedListener);
|
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
|
||||||
toggleAudio.addEventListener(MouseEvent.CLICK, toggleAudioHandler);
|
if(streamer == null) {
|
||||||
}
|
Alert.show('Missing flashvars: streamer');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
private function init():void {
|
file = FlexGlobals.topLevelApplication.parameters.file;
|
||||||
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
|
if(file == null) {
|
||||||
file = FlexGlobals.topLevelApplication.parameters.file;
|
Alert.show('Missing flashvars: file');
|
||||||
if(file == null) {
|
return;
|
||||||
Alert.show('Missing flashvars: file');
|
}
|
||||||
return;
|
|
||||||
}
|
playButton.addEventListener(MouseEvent.CLICK, playButtonListener);
|
||||||
if(streamer == null) {
|
fullscreenButton.addEventListener(MouseEvent.CLICK, fullscreenButtonListener);
|
||||||
Alert.show('Missing flashvars: streamer');
|
}
|
||||||
return;
|
]]>
|
||||||
}
|
</fx:Script>
|
||||||
videoDisplay.source = streamer + "/" + file;
|
<s:BorderContainer x="0" y="0" width="100%" height="100%">
|
||||||
initListeners();
|
<mx:VideoDisplay bufferTime="1" width="100%" height="100%" id="videoDisplay"></mx:VideoDisplay>
|
||||||
}
|
<s:Button label="Play" id="playButton" horizontalCenter="0" bottom="10"></s:Button>
|
||||||
]]>
|
<s:Button label="[ ]" id="fullscreenButton" right="10" bottom="10"></s:Button>
|
||||||
</fx:Script>
|
</s:BorderContainer>
|
||||||
<s:Panel x="0" y="0" width="100%" height="100%" title="RTMP Player">
|
|
||||||
<mx:VideoDisplay width="100%" height="100%" id="videoDisplay" autoPlay="false">
|
|
||||||
</mx:VideoDisplay>
|
|
||||||
<s:controlBarContent>
|
|
||||||
<s:Button label="Start Feed" id="toggleFeed"></s:Button>
|
|
||||||
<s:Spacer width="100%" height="100%"/>
|
|
||||||
<s:Button label="Mute" id="toggleAudio" enabled="false"></s:Button>
|
|
||||||
</s:controlBarContent>
|
|
||||||
</s:Panel>
|
|
||||||
</s:Application>
|
</s:Application>
|
||||||
|
|
Binary file not shown.
|
@ -78,6 +78,6 @@
|
||||||
</fx:Script>
|
</fx:Script>
|
||||||
<s:BorderContainer x="0" y="0" width="100%" height="100%">
|
<s:BorderContainer x="0" y="0" width="100%" height="100%">
|
||||||
<mx:VideoDisplay width="100%" height="100%" id="videoDisplay"></mx:VideoDisplay>
|
<mx:VideoDisplay width="100%" height="100%" id="videoDisplay"></mx:VideoDisplay>
|
||||||
<s:Button label="Publish" id="publishButton" horizontalCenter="0" verticalCenter="220"></s:Button>
|
<s:Button label="Publish" id="publishButton" horizontalCenter="0" bottom="10"></s:Button>
|
||||||
</s:BorderContainer>
|
</s:BorderContainer>
|
||||||
</s:Application>
|
</s:Application>
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,10 @@
|
||||||
streamer: 'rtmp://localhost/myapp',
|
streamer: 'rtmp://localhost/myapp',
|
||||||
file:'mystream'
|
file:'mystream'
|
||||||
};
|
};
|
||||||
swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "500", "400", "9.0.0", null, flashVars);
|
var params = {};
|
||||||
|
params.allowfullscreen = "true";
|
||||||
|
var attributes = {};
|
||||||
|
swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "640", "480", "9.0.0", null, flashVars, params, attributes);
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue