RTMP streaming with OSMF - AS3

5.2k views Asked by At

New to OSMF and trying to play a streaming mp4 on our limelight server. According to this tutorial http://www.adobe.com/devnet/flash/articles/video_osmf_streaming.html, you simply pass the RTMP link to the URLResource. I've tried that and it isn't working. It plays fine if I pass a local URL. I am using OSMF 1.5 SWC and my code is

package 
{
    import flash.display.*;
    import flash.events.*;
    import org.osmf.media.*;

    public class Main extends Sprite
    {
        private var mps:MediaPlayerSprite;

        public function Main()
        {
            stage.align     = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            mps             = new MediaPlayerSprite();
            mps.width       = 640;
            mps.height      = 360;
            mps.resource    = new URLResource("rtmp://my.limelight.host.net/mp4:dyk_seatbelts_high.mp4");
            addChild(mps);
        }
    }
}

I dont get any errors just a blank canvas. Any ideas?

2

There are 2 answers

2
ExtremeBt On BEST ANSWER

You should add streamer and video url for RTMP streaming. For example:

var resource:DynamicStreamingResource = new DynamicStreamingResource(videoStreamer);
resource.urlIncludesFMSApplicationInstance = true;
var vector:Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem>(1);
vector[0] = new DynamicStreamingItem(videoUrl, 1200);
resource.streamItems = vector;
element = new VideoElement(resource);

player.media = element;

You can add few dynamic streaming items. Video files with different bitrate.

Example for videoStreamer: rtmp://streamer_url

Example for videoUrl: mp4:path_to_video.mp4

0
S.Raaj Nishanth On

This is just an update. The DynamicStreamingItem is not available anymore. You can simply add your rtmp stream url to a StreamingURLResource. Plays like a charm. (Correct me if i'm wrong....i'm new to OSMF)

var videoElement:VideoElement = new VideoElement();
videoElement.resource = new StreamingURLResource("rtmp://cp140972.XXXXX",StreamType.LIVE,NaN,NaN,null,false);
player.media = videoElement;