How to understand live stream is online
Hi,
First sorry about my english, i search my problem, but i couldnt find my answer,
We have more then 80 live stream videos. More than 20 PC with capture cards, send cam streams to FSM with FME,
Problems,
PC can crush, capture card can crush, fme can crush, camera connection can crush,
so with below code, i can unterstand if FMS server is alive, "NetConnection.Connect.Success"
but is my stream alive? How i can understand "1test1" is alive,
for example i can unterstand with onMetaData info, if there is no meta info, no stream,
but i am a noob, what is the true way to understand live stream is alive, meta info isn't true way i think
i change var videoURL:String ="1test1" to a false value
but no error i get, it never says "NetStream.Play.StreamNotFound":
my goal is, i will make a web page, it will find all livestreams from xml, and cheack them, so systemadmin will see problem easly,
last question, if there is a camera problem, livestream gives a blank black screen, can i understand automaticly this screen ![]()
var videoURL:String ="1test1"
var nc:NetConnection = new NetConnection();
nc.client = this;
nc.connect("rtmp://myFMS/live/");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void{
trace(" trace netStatusHandler: " +event.info.code);
switch (event.info.code)
{
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + videoURL);
break;
}
}
function connectStream():void
{
var vid:Video = new Video(640,480);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
var meta:Object = new Object();
meta.onMetaData = function(info:Object){
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate)}
ns.client = meta;
addChild(vid);
vid.attachNetStream(ns);
ns.play(videoURL);
}
