Skip navigation
box86rowh
Currently Being Moderated

Please help me understand RTMP dynamic streaming

Dec 27, 2010 4:20 PM

Hello all,

I am using rtmp dynamic streaming loading my video files from Amazon Cloudfront and the videos load and play, however the stream never dynamically switches from the initial Index setting. 

I am setting up my media player object with:

 

mediaPlayer = new MediaPlayer();

mediaPlayer.addEventListener(TimeEvent.CURRENT_TIME_CHANGE, updateTime);

mediaPlayer.addEventListener(TimeEvent.COMPLETE, onDone);

mediaPlayer.addEventListener(DynamicStreamEvent.AUTO_SWITCH_CHANGE, onAutoChange);

mediaPlayer.addEventListener(DynamicStreamEvent.SWITCHING_CHANGE, onChange);

mediaPlayer.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_ STATE_CHANGE, onStateChange);

mediaPlayer.loop = false;

mediaPlayer.autoDynamicStreamSwitch = true;

mediaPlayer.bufferTime = 2;

mediaPlayer.autoRewind = false;

 

I am also setting up my media element :

 

var bitrates:XMLList = vid.videoEncodes.videoEncode;

var resource:DynamicStreamingResource = new DynamicStreamingResource(vid.@server + "_definst_");

var vector:Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem> (bitrates.length());

for(var i:Number = 0; i < bitrates.length(); i++){

vector[i] = (new DynamicStreamingItem("MP4:" + FILENAME, BITRATE));

}

resource.streamItems = vector;

resource.initialIndex = 0;

var videoElement:VideoElement = new VideoElement(resource);

videoElement.smoothing = true;

videoElement.deblocking = 0;

 

My video files have the keyframes set at 2 seconds apart. And have 4 bitrate file options, 400, 700,1000,1300.  But, as mentioned above the player starts on the initial index and stays there.  What am I doing wrong?

 

Thanks

 
Replies
  • Currently Being Moderated
    Dec 29, 2010 1:20 PM   in reply to box86rowh

    A couple of things to look at:

     

    1) The bitrate you pass to the the DynamicStreamingItem constructor needs to be in kilobits per second, double check that.

    2) If you turn on logging you will be able to determine which switching rule is recommending the zero index, I suspect it is the buffer rule. Try increasing your buffer to 8 and see if it improves.

     

    Thanks,

    - charles

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points