I've got a feature-heavy video player for a client that needs to do pretty much EVERYTHING that flash video can do. Included in the to-do list is bandwidth sniffing for dynamic video switching, which I've managed to make happen using SimpleClient, a custom netstream client class that can pump out the the users bandwidth(see below). The problem with this client is that it didn't include an onMetaData function that can give me all the stats on the streaming flv.
In short, does anyone know how to add that functionality to the following .as file? Or, perhaps, does some have a netstream client that DOES have all the bells and whistles?
//SimpleClient.as
package com {
import com.BandwidthEvent;
import flash.events.EventDispatcher;
public class SimpleClient extends EventDispatcher {
public function SimpleClient() {
}
public function onBWCheck(... rest):Number {
return 0;
}
public function onBWDone(... rest):void {
var bitrate:Number;
bitrate = rest[0];
dispatchEvent(new BandwidthEvent(BandwidthEvent.BANDWIDTH_RECEIVED, bitrate));
}
}
}
//BandwidthEvent.as that is refered to above
package com {
import flash.events.Event;
public class BandwidthEvent extends Event {
static public var BANDWIDTH_RECEIVED:String = "bandwidthReceived";
public var bandwidth:int;
public function BandwidthEvent(type:String, thebandwidth:int, bubbles:Boolean=false, cancelable:Boolean=false) {
super(type, bubbles, cancelable);
bandwidth = thebandwidth;
}
}
}