3 Replies Latest reply on Dec 29, 2010 3:39 PM by box86rowh

    Please help me understand RTMP dynamic streaming

    box86rowh Level 1

      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?