mirror of https://github.com/ossrs/srs.git
Merge branch 'srs.master'
commit
0c6282a048
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<actionScriptProperties analytics="false" mainApplicationPath="srs_reuse_conn.as" projectUUID="ccfd5c0a-9963-467a-8739-75ac79faaef5" version="10">
|
||||
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="release" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
|
||||
<compilerSourcePath/>
|
||||
<libraryPath defaultLinkType="0">
|
||||
<libraryPathEntry kind="4" path="">
|
||||
<excludedEntries>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
|
||||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
|
||||
</excludedEntries>
|
||||
</libraryPathEntry>
|
||||
<libraryPathEntry kind="3" linkType="1" path="FlashCS5UI.swc" useDefaultLinkType="false"/>
|
||||
</libraryPath>
|
||||
<sourceAttachmentPath/>
|
||||
</compiler>
|
||||
<applications>
|
||||
<application path="srs_reuse_conn.as"/>
|
||||
</applications>
|
||||
<modules/>
|
||||
<buildCSSFiles/>
|
||||
<flashCatalyst validateFlashCatalystCompatibility="false"/>
|
||||
</actionScriptProperties>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>srs_reuse_conn</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.adobe.flexbuilder.project.flexbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,3 @@
|
||||
#Sat Nov 22 18:40:22 CST 2014
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=utf-8
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,123 @@
|
||||
package
|
||||
{
|
||||
import fl.controls.Button;
|
||||
import fl.controls.TextInput;
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.display.StageAlign;
|
||||
import flash.display.StageScaleMode;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.media.Video;
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.NetStream;
|
||||
|
||||
[SWF(backgroundColor="0xEEEEEE",frameRate="30",width="1024",height="576")]
|
||||
public class srs_reuse_conn extends Sprite
|
||||
{
|
||||
public function srs_reuse_conn()
|
||||
{
|
||||
if (stage) {
|
||||
onAddedToStage(null);
|
||||
} else {
|
||||
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
|
||||
}
|
||||
}
|
||||
|
||||
private function onAddedToStage(evt:Event):void
|
||||
{
|
||||
stage.align = StageAlign.TOP_LEFT;
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
|
||||
var txtUrl:TextInput = new TextInput();
|
||||
var btnConn:Button = new Button();
|
||||
var btnPlay:Button = new Button();
|
||||
|
||||
txtUrl.x = 10;
|
||||
txtUrl.y = 10;
|
||||
txtUrl.width = 400;
|
||||
txtUrl.text = "rtmp://dev/live/livestream";
|
||||
addChild(txtUrl);
|
||||
|
||||
btnConn.label = "Connect";
|
||||
btnConn.x = txtUrl.x + txtUrl.width + 10;
|
||||
btnConn.y = txtUrl.y;
|
||||
btnConn.width = 100;
|
||||
addChild(btnConn);
|
||||
|
||||
btnPlay.label = "Play";
|
||||
btnPlay.x = btnConn.x + btnConn.width + 10;
|
||||
btnPlay.y = btnConn.y;
|
||||
btnPlay.width = 100;
|
||||
addChild(btnPlay);
|
||||
|
||||
var video:Video = new Video();
|
||||
video.x = txtUrl.x;
|
||||
video.y = txtUrl.y + txtUrl.height + 10;
|
||||
addChild(video);
|
||||
|
||||
var conn:NetConnection = null;
|
||||
var stream:NetStream = null;
|
||||
|
||||
var tcUrl:Function = function():String {
|
||||
var url:String = txtUrl.text;
|
||||
return url.substr(0, url.lastIndexOf("/"));
|
||||
}
|
||||
var streamName:Function = function():String {
|
||||
var url:String = txtUrl.text;
|
||||
return url.substr(tcUrl().length + 1);
|
||||
}
|
||||
|
||||
var closeConnection:Function = function():void {
|
||||
if (stream) {
|
||||
stream.close();
|
||||
stream = null;
|
||||
}
|
||||
if (conn) {
|
||||
conn.close();
|
||||
conn = null;
|
||||
}
|
||||
btnConn.label = "Connect";
|
||||
btnPlay.visible = false;
|
||||
};
|
||||
|
||||
btnPlay.visible = false;
|
||||
btnConn.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
|
||||
if (btnConn.label == "Connect") {
|
||||
conn = new NetConnection();
|
||||
conn.client = {
|
||||
onBWDone: function():void{}
|
||||
};
|
||||
conn.addEventListener(NetStatusEvent.NET_STATUS, function(ne:NetStatusEvent):void {
|
||||
if (ne.info.code == "NetConnection.Connect.Success") {
|
||||
btnPlay.visible = true;
|
||||
} else if (ne.info.code == "NetConnection.Connect.Closed") {
|
||||
closeConnection();
|
||||
}
|
||||
trace(ne.info.code);
|
||||
});
|
||||
conn.connect(tcUrl());
|
||||
btnConn.label = "Close";
|
||||
} else {
|
||||
closeConnection();
|
||||
}
|
||||
});
|
||||
btnPlay.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
|
||||
if (stream) {
|
||||
stream.close();
|
||||
stream = null;
|
||||
}
|
||||
stream = new NetStream(conn);
|
||||
stream.client = {
|
||||
onMetaData: function(metadata:Object):void {
|
||||
video.width = metadata.width;
|
||||
video.height = metadata.height;
|
||||
}
|
||||
};
|
||||
video.attachNetStream(stream);
|
||||
stream.play(streamName());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue