mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-09 14:11:07 +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"?>
|
||||
<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()">
|
||||
xmlns:s="library://ns.adobe.com/flex/spark"
|
||||
xmlns:mx="library://ns.adobe.com/flex/mx"
|
||||
minWidth="500" minHeight="350" creationComplete="init()">
|
||||
|
||||
<fx:Declarations>
|
||||
<!-- Place non-visual elements (e.g., services, value objects) here -->
|
||||
</fx:Declarations>
|
||||
<fx:Script>
|
||||
<![CDATA[
|
||||
import mx.controls.Alert;
|
||||
import mx.core.FlexGlobals;
|
||||
import flash.display.StageDisplayState;
|
||||
import mx.managers.SystemManager;
|
||||
|
||||
<fx:Script>
|
||||
<![CDATA[
|
||||
import mx.controls.Alert;
|
||||
import mx.core.FlexGlobals;
|
||||
private var streamer:String;
|
||||
private var file:String;
|
||||
private var streamer:String;
|
||||
private var file:String;
|
||||
|
||||
private function toggleFeedListener(event:MouseEvent):void {
|
||||
if(toggleFeed.label == 'Start Feed') {
|
||||
toggleFeed.label = 'Stop Feed';
|
||||
toggleAudio.enabled = true;
|
||||
videoDisplay.play();
|
||||
} else {
|
||||
toggleFeed.label = 'Start Feed';
|
||||
toggleAudio.enabled = false;
|
||||
videoDisplay.close();
|
||||
}
|
||||
}
|
||||
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 toggleAudioHandler(event:MouseEvent):void {
|
||||
if(toggleAudio.label == 'Unmute') {
|
||||
toggleAudio.label = 'Mute';
|
||||
videoDisplay.volume = 1;
|
||||
} else {
|
||||
toggleAudio.label = 'Unmute';
|
||||
videoDisplay.volume = 0;
|
||||
}
|
||||
}
|
||||
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 initListeners():void {
|
||||
toggleFeed.addEventListener(MouseEvent.CLICK, toggleFeedListener);
|
||||
toggleAudio.addEventListener(MouseEvent.CLICK, toggleAudioHandler);
|
||||
}
|
||||
private function init():void {
|
||||
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
|
||||
if(streamer == null) {
|
||||
Alert.show('Missing flashvars: streamer');
|
||||
return;
|
||||
}
|
||||
|
||||
private function init():void {
|
||||
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
|
||||
file = FlexGlobals.topLevelApplication.parameters.file;
|
||||
if(file == null) {
|
||||
Alert.show('Missing flashvars: file');
|
||||
return;
|
||||
}
|
||||
if(streamer == null) {
|
||||
Alert.show('Missing flashvars: streamer');
|
||||
return;
|
||||
}
|
||||
videoDisplay.source = streamer + "/" + file;
|
||||
initListeners();
|
||||
}
|
||||
]]>
|
||||
</fx:Script>
|
||||
<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>
|
||||
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%">
|
||||
<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>
|
||||
</s:BorderContainer>
|
||||
</s:Application>
|
||||
|
|
Binary file not shown.
|
@ -78,6 +78,6 @@
|
|||
</fx:Script>
|
||||
<s:BorderContainer x="0" y="0" width="100%" height="100%">
|
||||
<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:Application>
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,10 @@
|
|||
streamer: 'rtmp://localhost/myapp',
|
||||
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>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in a new issue