mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-09 14:11:07 +02:00
added test player
This commit is contained in:
commit
250ca9818a
|
@ -2,7 +2,7 @@
|
|||
|
||||
Simple RTMP publisher.
|
||||
|
||||
Edit the following flashvars in demo.html to suite your needs.
|
||||
Edit the following flashvars in publisher.html & player.html to suite your needs.
|
||||
|
||||
streamer: RTMP endpoint
|
||||
file: live stream name
|
||||
|
@ -12,3 +12,4 @@ file: live stream name
|
|||
Install flex sdk http://www.adobe.com/devnet/flex/flex-sdk-download.html
|
||||
|
||||
mxmlc RtmpPublisher.mxml
|
||||
mxmlc RtmpPlayer.mxml
|
||||
|
|
70
test/rtmp-publisher/RtmpPlayer.mxml
Normal file
70
test/rtmp-publisher/RtmpPlayer.mxml
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?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:Declarations>
|
||||
<!-- Place non-visual elements (e.g., services, value objects) here -->
|
||||
</fx:Declarations>
|
||||
|
||||
<fx:Script>
|
||||
<![CDATA[
|
||||
import mx.controls.Alert;
|
||||
import mx.core.FlexGlobals;
|
||||
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 toggleAudioHandler(event:MouseEvent):void {
|
||||
if(toggleAudio.label == 'Unmute') {
|
||||
toggleAudio.label = 'Mute';
|
||||
videoDisplay.volume = 1;
|
||||
} else {
|
||||
toggleAudio.label = 'Unmute';
|
||||
videoDisplay.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function initListeners():void {
|
||||
toggleFeed.addEventListener(MouseEvent.CLICK, toggleFeedListener);
|
||||
toggleAudio.addEventListener(MouseEvent.CLICK, toggleAudioHandler);
|
||||
}
|
||||
|
||||
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>
|
||||
</s:Application>
|
BIN
test/rtmp-publisher/RtmpPlayer.swf
Normal file
BIN
test/rtmp-publisher/RtmpPlayer.swf
Normal file
Binary file not shown.
Binary file not shown.
19
test/rtmp-publisher/player.html
Normal file
19
test/rtmp-publisher/player.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>RTMP Player</title>
|
||||
<script type="text/javascript" src="swfobject.js"></script>
|
||||
<script type="text/javascript">
|
||||
var flashVars = {
|
||||
streamer: 'rtmp://localhost/myapp',
|
||||
file:'mystream'
|
||||
};
|
||||
swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "500", "400", "9.0.0", null, flashVars);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="rtmp-publisher">
|
||||
<p>Flash not installed</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
19
test/rtmp-publisher/publisher.html
Normal file
19
test/rtmp-publisher/publisher.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>RTMP Publisher</title>
|
||||
<script type="text/javascript" src="swfobject.js"></script>
|
||||
<script type="text/javascript">
|
||||
var flashVars = {
|
||||
streamer: 'rtmp://localhost/myapp',
|
||||
file:'mystream'
|
||||
};
|
||||
swfobject.embedSWF("RtmpPublisher.swf", "rtmp-publisher", "500", "400", "9.0.0", null, flashVars);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="rtmp-publisher">
|
||||
<p>Flash not installed</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue