Hi,
My video player keeps crashing.
Works fine on pre-recorded video streams but when I try and connect to a live video stream it crashes. This is happening in the browser and in the Flash application. If I remove the live netstream the player works fine.
Am I missing something with the setup for a live stream?
No idea how to debug?
var nc:NetConnection = new NetConnection();
var ns:NetStream;
netConnectionDir = "rtmp://videoserverurl/"
streamURL = "video"
//Removes two error messages from stopping the player working
nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
function onNetStatus(evt:NetStatusEvent):void {
if (evt.info.code =="NetConnection.Connect.Success") {
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var myVideo:Video = new Video(768,432);
myVideo.attachNetStream(ns);
addChild(myVideo);
};
};
//The streaming URL
nc.connect(netConnectionDir,true);
//Removes further error messages that stop the player working
function asyncErrorHandler(event:AsyncErrorEvent):void{
//ignore error;
}
NetConnection.prototype.onBWDone = function(p_bw) {
//trace("onBWDone: "+p_bw);
}
NetConnection.prototype.onBWCheck = function() {
return ++counter;
}
mcPlay.addEventListener(MouseEvent.CLICK, fcPlayVideoClick);
mcPlay.addEventListener(MouseEvent.ROLL_OVER, fcPlayVideoRollover);
mcPlay.addEventListener(MouseEvent.ROLL_OUT, fcPlayVideoRollout);
mcPlay.buttonMode = true;
function fcPlayVideoClick(e:MouseEvent):void {
ns.play(streamURL, true);
}