RTMP Streaming

Must Read

Just post!

Real Time Messaging Protocol (RTMP) is a protocol using a streaming server such as Flash Media Server or a streaming service such as Influxis or Flash Media Server for Amazon Web Services.

Streaming uses a lot of data. Inform your users to use WiFi so that it is not too costly and guarantees the best possible quality experience.

RTMP server

Let’s use our RTMP server to stream an on-demand video. As in progressive downloading, streaming uses a Video, a NetConnection, and a NetStream object.

NetConnection connects to the streaming server. The protocol used is rtmp. Note the streamClient variable. You need it for callbacks; otherwise, you will get a runtime error:

[code]static const SERVER:String = “rtmp://SERVER_URI/vod/;
static const VIDEO_PATH:String = “/myVideo”;
video = new Video();
video.width = 480;
video.height = 320;
connection.addEventListener(NetStatusEvent.NET_STATUS, onNetEvent);
function netConnectionEvent(event:NetStatusEvent):void {
if ( == “NetConnection.Connect.Success”) {
var stream:NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, onStreamEvent);
var streamClient:Object = new Object();
streamClient.onMetaData = onMetaData;
stream.client = streamClient;
function onStreamEvent(event:NetStatusEvent):void {}
function onMetaData(info:Object):void {}
function onBWDone():void {}[/code]

It is a good idea to add listeners for connection errors while debugging and to inform your audience in case of an issue:

[code]connection.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
function onIOError(event:IOErrorEvent):void {}
function onSecurityError(event:SecurityErrorEvent):void {}
function onASyncError(event:AsyncErrorEvent):void {}[/code]

Local Flash Media Server

You can install a local Flash Media Server to run and test your applications. Change the path to your local server. To ensure the video plays, turn off .swf verifications on the server:

[code]static const SERVER:String = “rtmp://localhost/vod/”;[/code]

Flash Media Server offers features to examine and monitor your video streams. The Quality of Service API, for instance, returns the user’s current bandwidth. You can extend the functionality of your video management by writing additional server code.


- Advertisement -

Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place at the...
- Advertisement -

More Articles Like This

- Advertisement -