Groups | Blog | Home
all groups > macromedia flash flashcom > march 2006 >

macromedia flash flashcom : FMS2 Developer Edition and License Limitations RE: Streaming


bjohnson2
3/20/2006 11:55:14 PM
Hello everyone!

I'm new to Flash, and I'm attempting to create a very simple Flash app that
simply loads an FLV stored in an application directory on my FMS2 Developer
Edition and streams it using NetStream. The ActionScript code for my FLA file
follows all the examples I've seen on the Net. From the FMS server's management
console, I can see the connection coming in, and I can see that it is
supposedly streaming the requested FLV file. And when I hit the play and pause
buttons in my Flash App, the FMS management console indicates that the
streaming FLV is being paused and played correctly. However, I don't actually
SEE the content in the Flash app. It's basically a blank window with play and
pause buttons.

So I'm stumped. Communication between my client Flash app and the FMS seems to
be working, but I can't see my video. My only thought at this point is that
maybe because I'm using a trial version of Flash Professional 8 and the
developer version of FMS that maybe it won't let me "deploy" the application,
so to speak. Does anyone know if this might be the case?

Otherwise, I can post my FLA ActionScript code and my FMS configuration here
and maybe someone will have an idea what I'm missing. Thanks in advance for
help. The world of Flash seems pretty cool and I'm looking forward to learning.

Thanks!
JayCharles
3/21/2006 12:00:00 AM
The only problem I see in your code is the name of your video sream. When using
FCS/FMS, you don't use the .flv extension on the file name. So... change this
line:

myNetStream.play("vidfile.flv");

to this:

myNetStream.play("vidfile");

.. and you should be good to go.
bjohnson2
3/21/2006 12:00:00 AM
JayCharles,

I had actually tried that becuase I read somewhere else that it doesn't like
the FLV extension. But when I took it off, it still didn't work, so I put it
back on. I'll go ahead and take it back off again.

I've even tried putting in filenames of FLVs that don't exist. When I load the
SWF, it connects to the FMS and claims it's playing the stream for that file,
whether the file actually exists on the server or not.

Do I have to do anything with MIME types? I already had to register the FLV
MIME type with IIS to get my swf files that do progressive downloads of the
FLVs to work. Is there something along those lines I need to do with FMS? Is
FMS looking in the wrong directory for streams? I've set up the FLV directory
in the StorageDir tag of the StreamManager section in my default virtual host's
Application.xml file as C:\Flashstuff\flv\. Is there anything else I can try
downloading using the rtmp protocol so I can try debugging that?

I feel like I'm so close to getting this to work...

Thanks again.
JayCharles
3/21/2006 3:30:45 AM
Sounds like an actionscript problem (perhaps you didn't attach the stram video to a video object?)

bjohnson2
3/21/2006 4:28:45 AM
Thanks for responding, JayCharles. Here's the code from the FLA/SWF file. It is
the actionscript for the first frame of the file.
----
var myVideo:Video;
var playButton:Button;
var pauseButton:Button;

var myNetConnection:NetConnection = new NetConnection();

myNetConnection.connect("rtmp://192.168.1.225/myvidstream/");

var myNetStream:NetStream = new NetStream(myNetConnection);
myVideo.attachVideo(myNetStream);
myNetStream.setBufferTime(5);
myNetStream.play("vidfile.flv");
trace("Video Size is: "+myNetStream.bytesTotal + " and " +
myNetStream.bufferLength + " and " + myNetStream.bufferTime);


playButton.onPress = function() {
myNetStream.pause(false);
}

pauseButton.onPress= function() {
myNetStream.pause(true);
}

----
When I run the resulting SWF, it connects to the server, and the server thinks
it's streaming vidfile.flv, but nothing shows up on the screen.

The main.asc file for the "myvidstream" app on the FMS is just a standard one
I copied from a textbook:

----
load( "components.asc" );

application.onConnect = function( newClient, newUserName, test ) {
gFrameworkFC.getClientGlobals(newClient).username = newUserName;
application.acceptConnection(newClient);
}
----

Hopefully someone sees a glaring error that is causing my problem!

Thanks!
JayCharles
3/21/2006 4:24:59 PM
It seems to me that your .flv file is either in the wrong place, or the name
doesn't match. Since your are running the default instance of your app, your
file should be in this location:

appDirectory>streams>_definst_>videofile.flv

Read up on the docs for netstream.play. There are a coulple of switches that
tell FMS what to do if there is no recorded stream at the location specified.
If you don't set them, FMS will open a new live stream if there;s no recorded
stream with the name you specified.
bjohnson2
3/21/2006 5:41:04 PM
It's working! I created the _definst_ directory under my streams directory and
now it's working. So to sum up, here are the things I was doing wrong:

1) My SWF file was trying to do the NetStream play with a filename extension,
so I was doing netstream.play("vidfile.flv") instead of
netstream.play("vidfile").
2) I had my streams directory setup in the Application.xml
<StreamManager><StorageDir> section. I removed this and let it use the default
"streams" subdirectory of my application's directory.
3) I put the FLVs in a _definst_ subdirectory under the default streams
directory. I think this was the last key I was missing, as the streams
directory I had been using didn't have one. All my FLVs were in the root of the
"streams" directory.

The sad thing is that at one point, I had created a directory structure with a
_definst_ subdirectory, but it wasn't working for other reasons (the .flv
extension and a misconfigured FMS at the time). I never went back to try it
with the _definst_ subdirectory again.

Thanks again for all your help!
Nethus
5/18/2006 12:00:00 AM
I have installed FMS2 in my computer (Win XP) and I'm trying to do streaming
with flv video.
I've flv into application folder applications\videowai\wachi\videowai.flv and
also into applications\videowai\videowai.flv and also
applications\videowai\_definst_\videowai.flv
The swf is in the wwwroot virtual folder of the same computer.

Everytime I execute swf I see a new instance created into the FMS2 console but
I CAN'T SEE ANYTHING, no video is played into the swf. However, using the same
actionscript but, instead of use 'url' in connection parameter y use null and
it reads a local flv file, I can see de movie.


It is the actionscript for the first frame of the file.
----------------------
//10.20.1.40 is localhost
var url = "rtmp://10.20.1.40/videowai/wachi";
var conexion:NetConnection = new NetConnection();
conexion.connect(url);
var my_ns:NetStream = new NetStream(conexion);

mi_peli2.attachVideo(my_ns);

my_ns.setBufferTime(5);
my_ns.play("videowai");

------------------------

I have no main.asc file. I don't know what it is for.

Thank you.



AddThis Social Bookmark Button