I'm having trouble viewing streamed video, how can I confirm the server is working?
Graeme Bull - Oct 13, 2007
I actually receive and see this one on forums quite a bit so let's see if I can shed a bit of light on things.
The question: I'm having trouble viewing streamed video, how can I confirm the server is working?
The answer:
First thing to do here is supply a link to a previous article I wrote on this subject:
http://www.sti-media.com/blog/archives/000217.html
So that's how you would setup the server for the FLV file.
For the flash side, let's cover the basics.
1. Open a new FLA file (flash 7 and up)
2. Go to the library and click the menu button and choose "New Video"
3. Choose "Video actionscript controlled"
4. Once the video object is on the stage, select it and put in an instance name of "vid" for now.
From this point forward I'll just post some quick actionscript to test if video will play from a server. We'll use the video file "myVideo.flv". So just substitute that in the code for whatever you are using. (sorry about the code unfriendly blog here..)
//create a netConnection
var nc:NetConnection = new NetConnection();
//create the net stream to play the video
var ns:NetStream = new NetStream(nc);
//attach the net stream to the video object
vid.attachVideo(ns);
//handle the information objects from the net connection
nc.onStatus = function(info){
if(info.code == "NetConnection.Connect.Success"){
//connection success, play the stream
playTheStream();
}
}
//function to play the stream
function playTheStream(){
//0 is for a prerecorded stream, -1 is to play it until it ends
ns.play("myVideo", 0, -1);
}
nc.connect("rtmp://MYSERVER/videoApplication/videoplayer");
That's pretty much it. If your video does not play in the screen when you publish that file and you are connecting up successfully then you don't have the video file in the right spot. Double check that.
If you can't connect up then double check the connection string to see if you have the right server, right application and actually check to make sure the server is running and the ports are open that you have set for the server.
That's all folks.