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
and, the onchange function does this:
public function onChange(e:DynamicStreamEvent):void{
if(e.switching){
trace("Change Request");
}else{
trace("CHANGE - " + mediaPlayer.currentDynamicStreamIndex + " " + mediaPlayer.maxAllowedDynamicStreamIndex + " " + "Current bitrate = " + mediaPlayer.getBitrateForDynamicStreamIndex(mediaPlayer.currentDynami cStreamIndex) + "kbps");
}
}
the trace always shows me 3 as the maxallowed, and 400 as my currentBitrate
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
Hi, Thanks for your reply.
For now I am scrapping the Dynamic switching piece of our playback and allowing the user to choose what quality they want.
Anyone thats willing, can you check the video player in the header on this test page and report back on your assesment of the performance / experiance / video quality?
http://www.video-postcard.com/clientDemos/visitMaine-dead.html
Thanks
Jason
North America
Europe, Middle East and Africa
Asia Pacific