Groups | Blog | Home
all groups > macromedia flash flashcom > october 2005 >

macromedia flash flashcom : load default FLV is loadVideo fails? how to detect error?


JayCharles
10/29/2005 12:00:00 AM
You're assiging the onStatus event to the netConnection, where you should be
assiging it to the stream:

myns = new NetStream(main_nc);
myns.onStatus = function(info) {
if (info.code == "NetStream.Play.StreamNotFound" || info.code ==
"NetStream.Play.Failed"){
// insert your error actions here.
}
}
lavalfrank
10/29/2005 5:54:58 AM
how can i detect a loading error and then load a default video?

or

Detect if a file exist on server ??

How to please

thanks.
JayCharles
10/29/2005 7:06:27 AM
Well, you could handle it on either the client side or the server side. I
prefer to do things like this on the client side so conserve server resources
(every little bit helps)

On the client side, you're looking for a failure notice in the onstatus event
for your stream. Remember, you should declare your onstatus event before you
connect to the stream.

Like this:
[code]
myStream.onStatus = function(info) {
if (info.code == "NetStream.Play.StreamNotFound" || info.code ==
"NetStream.Play.Failed"){
// insert your error actions here.
}
}
[/code]
lavalfrank
10/29/2005 7:08:33 AM
lavalfrank
10/29/2005 8:01:47 AM
Cant make this work

// Connects to the flashcom server

main_nc = new NetConnection();
main_nc.connect("rtmp:/localhost");
main_nc.onStatus = function(infoObject) {
if (infoObject.code == "NetStream.Play.StreamNotFound" || infoObject.code ==
"NetStream.Play.Failed"){
_root.gotoAndPlay("bad");
}
// Successful connection to the server
if (infoObject.code == "NetConnection.Connect.Success") {
myns = new NetStream(main_nc);
playvideo();
}

// Connection failed
if (infoObject.code == "NetConnection.Connect.Failed") {
trace("Connection failed.");
}
};




// Handles the connection events


// Receive the video signal and play it
function playvideo() {
myns.play("webcam");
myvideo.deblocking=2;
myvideo.smoothing = true;
myvideo.attachVideo(myns);
}

stop();

lavalfrank
10/29/2005 9:01:20 PM
Thanks for your help but where do i but it it'S still not working

// Connects to the flashcom server

main_nc = new NetConnection();
main_nc.connect("rtmp:/localhost");
main_nc.onStatus = function(infoObject) {

// Successful connection to the server
if (infoObject.code == "NetConnection.Connect.Success") {
myns = new NetStream(main_nc);
myns.onStatus = function(info) {
if (info.code == "NetStream.Play.StreamNotFound" || info.code ==
"NetStream.Play.Failed"){
// insert your error actions here.
myns = new NetStream(main_nc);
playvideo2();
}
}
playvideo();
}

// Connection failed
if (infoObject.code == "NetConnection.Connect.Failed") {
trace("Connection failed.");
}
};

// Handles the connection events

// Receive the video signal and play it
function playvideo() {
myns.play("bad");
myvideo.deblocking=2;
myvideo.smoothing = true;
myvideo.attachVideo(myns);
}
function playvideo2() {
myns.play("good");
myvideo.deblocking=2;
myvideo.smoothing = true;
myvideo.attachVideo(myns);
}
stop();
lavalfrank
11/3/2005 11:19:17 PM
lavalfrank
11/11/2005 1:51:11 AM
It's only working wan i set the connect to null (like to get file in local
directory and in the flashcomm server)

Any one can help please or no how to do this, detect if a flv file or stream
exist on the flash comme server, on StreamNotFound go to frame 1 else goto
frame 2 ???

It chuld be simple thing to do or primary fonction like
NetConnection.Connect.Success and NetConnection.Connect.Failed???

// Connects to the flashcom server

main_nc = new NetConnection();
main_nc.connect(null);
myns = new NetStream(main_nc);
myns.play("webcamjjjj");
myvideo.deblocking=2;
myvideo.smoothing = true;
myvideo.attachVideo(myns);
myns.onStatus = function(infoObject:Object) {
if (infoObject.code == "NetStream.Play.StreamNotFound") {
_root.gotoAndPlay("bad");
}


};



// Handles the connection events



stop();
AddThis Social Bookmark Button