Publishing from server to server
About multipoint publishing
Multipoint publishing allows clients to publish to servers with only one client-to-server connection. This feature enables you to build large-scale live broadcasting applications, even with servers or subscribers in different geographic locations.
Using multipoint publishing to publish content from server to server, even across geographic boundaries
A.
Live Video B.
Server 1 (New York City) C.
Server 2 (Chicago) and Server 3 (Los Angeles) D.
Users
The application flow that corresponds to this illustration works like as follows:
1
A client connects to an application on Server 1 in New York City and calls
NetStream.publish()
to publish a live stream. This client can be a custom Flash Player or AIR application or Flash Media Live Encoder.
canSeekToEnd
Boolean
Whether the last video frame is a keyframe (
true
if yes,
false
if no).
creationdate
String
The date the file was created.
createdby
String
The name of the file creator.
Metadata property name Data type Description
BCDA
F LASH M EDIA SERV ER 3.5 DEVELOPER GUIDE 70
Working with live video
2
The server-side script on Server 1 receives an
application.onPublish()
event with the name of the published stream.
3
The
application.onPublish()
handler creates a NetStream object and calls
NetStream.publish()
to republish the live stream to Server 2 (Chicago) and Server 3 (Los Angeles).
4
Subscribers connecting to Server 2 and Server 3 receive the same live stream.
5
The applications receive
application.onUnpublish()
events when the clients stops publishing.
Example: Multipoint publishing
In this example, the client captures, encodes, and publishes the stream to the server. You can also use Flash Media Live Encoder for the same purpose.
Note: To test this code, create a RootInstall/applications/livestreams folder on the server. Open the Administration Console and create an instance of the livestreams application. Click Live Logs to see the server-side
trace()
statements as the application runs. Open the RootInstall/documentation/samples/livestreams/LiveStreams.swf file to connect to the application.
1
In a client-side script, call the
NetStream.publish()
method to publish a live stream:
ns.publish("localnews", "live");
Note: To use Flash Media Live Encoder as a publishing client, enter the FMS URL
rtmp://localhost/livestreams
and the Stream
localnews
.
2
In the server-side main.asc file, define an
application.onPublish()
event handler. This handler accepts the stream name that was published from the client, connects to the remote server, and republishes the stream to the remote server. (In this example, the remove server is another instance of the same application).
// Called when the client publishes
application.onPublish = function(client, myStream) {
trace(myStream.name + " is publishing into application " + application.name);
// This is an example of using the multi-point publish feature to republish
// streams to another application instance on the local server.
if (application.name == "livestreams/_definst_"){
trace("Republishing the stream into livestreams/anotherinstance");
nc = new NetConnection();
nc.connect( "rtmp://localhost/livestreams/anotherinstance" );
ns = new NetStream(nc);
// called when the server NetStream object has a status
ns.onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing");
}
}
ns.setBufferTime(2);
ns.attach(myStream);
ns.publish( myStream.name, "live" );
}
}
Calling
NetStream.publish()
publishes the stream from your server to the remote server.
3
In the main.asc file, handle events that occur on the NetStream object you used to publish from your server to the remote server:
About multipoint publishing
Multipoint publishing allows clients to publish to servers with only one client-to-server connection. This feature enables you to build large-scale live broadcasting applications, even with servers or subscribers in different geographic locations.
Using multipoint publishing to publish content from server to server, even across geographic boundaries
A.
Live Video B.
Server 1 (New York City) C.
Server 2 (Chicago) and Server 3 (Los Angeles) D.
Users
The application flow that corresponds to this illustration works like as follows:
1
A client connects to an application on Server 1 in New York City and calls
NetStream.publish()
to publish a live stream. This client can be a custom Flash Player or AIR application or Flash Media Live Encoder.
canSeekToEnd
Boolean
Whether the last video frame is a keyframe (
true
if yes,
false
if no).
creationdate
String
The date the file was created.
createdby
String
The name of the file creator.
Metadata property name Data type Description
BCDA
F LASH M EDIA SERV ER 3.5 DEVELOPER GUIDE 70
Working with live video
2
The server-side script on Server 1 receives an
application.onPublish()
event with the name of the published stream.
3
The
application.onPublish()
handler creates a NetStream object and calls
NetStream.publish()
to republish the live stream to Server 2 (Chicago) and Server 3 (Los Angeles).
4
Subscribers connecting to Server 2 and Server 3 receive the same live stream.
5
The applications receive
application.onUnpublish()
events when the clients stops publishing.
Example: Multipoint publishing
In this example, the client captures, encodes, and publishes the stream to the server. You can also use Flash Media Live Encoder for the same purpose.
Note: To test this code, create a RootInstall/applications/livestreams folder on the server. Open the Administration Console and create an instance of the livestreams application. Click Live Logs to see the server-side
trace()
statements as the application runs. Open the RootInstall/documentation/samples/livestreams/LiveStreams.swf file to connect to the application.
1
In a client-side script, call the
NetStream.publish()
method to publish a live stream:
ns.publish("localnews", "live");
Note: To use Flash Media Live Encoder as a publishing client, enter the FMS URL
rtmp://localhost/livestreams
and the Stream
localnews
.
2
In the server-side main.asc file, define an
application.onPublish()
event handler. This handler accepts the stream name that was published from the client, connects to the remote server, and republishes the stream to the remote server. (In this example, the remove server is another instance of the same application).
// Called when the client publishes
application.onPublish = function(client, myStream) {
trace(myStream.name + " is publishing into application " + application.name);
// This is an example of using the multi-point publish feature to republish
// streams to another application instance on the local server.
if (application.name == "livestreams/_definst_"){
trace("Republishing the stream into livestreams/anotherinstance");
nc = new NetConnection();
nc.connect( "rtmp://localhost/livestreams/anotherinstance" );
ns = new NetStream(nc);
// called when the server NetStream object has a status
ns.onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing");
}
}
ns.setBufferTime(2);
ns.attach(myStream);
ns.publish( myStream.name, "live" );
}
}
Calling
NetStream.publish()
publishes the stream from your server to the remote server.
3
In the main.asc file, handle events that occur on the NetStream object you used to publish from your server to the remote server:
'생활정보 > it' 카테고리의 다른 글
사이트맵을 생성 구글 웹마스트툴에 등록하기 (0) | 2015.12.31 |
---|---|
RDP 원격 제어 프로그램 mRemoteNG (0) | 2015.12.22 |
동영상 파일 포멧을 쉽게 보는 툴 소개 (0) | 2015.12.21 |
드라마 전편을 공짜로 볼수 있는 곳 (0) | 2009.06.18 |
windows media 서버에서 wsx파일의 smil 문법을 이용한 장애시 공지 방법 (0) | 2009.06.18 |
[flash 미디어 서비스 정리] Flash Media Server 3.5 설치 및 사용법 (0) | 2009.06.15 |
[flash 미디어 서비스 정리] Flash live encoder3.01 사용법 (0) | 2009.06.15 |
XCOPY 명령어 도움말 (0) | 2009.05.14 |
리눅스 ( linux ) 설치 간단 메뉴얼 (0) | 2009.05.14 |
windows 7 RC 정보모음 (0) | 2009.05.14 |