PDA

View Full Version : Retrieving the length a streamed flv through PHP


303 maddec
11-04-2004, 03:00 PM
Hi there,
I have tested the method described here, but I didn't manage to make it working: http://www.metasphere.net/help/FCS-1015.html

I'd like to know if this require Flash Communication Serveur, or if it can be easily done simply with Flash MX or MX2004 ???

Did someone test this tutorial and managed to make it working properly???

Thank you in advance for your help!

Best regards.

petefs
11-04-2004, 07:02 PM
Indeed that's the FCS way to do it. To my knowledge you can't stream FLVs without FCS -- you can use progressive downloading however, which really is just as good IMHO ^_^ In that case you use the 'undocumented' NetStream.onMetaData event

first, on your HDD browse on over to C:\Documents and Settings\<your user>\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes

and open NetStream.as

on line 9 (beneath 'function NetStream(connection:NetConnection);') add:
function onMetaData(info:Object):Void;

then you can retrieve the metadata like this:


var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);

ns.onMetaData = function(obj) {
duration = Math.round(obj.duration);
datarate = obj.videodatarate + obj.audiodatarate;
};


If you really don't want to edit the Macromedia released NetStream class file (although there's no real reason not to, I'd say : b) then you can just use

var ns= new NetStream(nc);
instead of
var ns:NetStream = new NetStream(nc);
but strictly typing the NetStream without adding that line to the class file will throw compile errors. Hope that gets you going ^_^ If you still have problems, make sure your FLVs have meta data in them (automatically done with the updated FLV export from macromedia -- if you have old files you want to add metadata to you can use this: http://www.buraks.com/flvmdi/flvmdi100exe.zip

Jacob Kerr
11-04-2004, 07:47 PM
Hey,

Thanx this is interesting stuff I have added to a note pad in my study folder on my comp :).

Thanx,

petefs
11-04-2004, 07:54 PM
no problem : ) Having a repository of useful info is crucial ; )

I got sick of the bloated and difficult to skin v2 components so I had to write a media player a few weeks ago. it was fresh on the mind : )

if you're into FLV there's some good info on http://www.flvplayer.com/ in the forums

303 maddec
11-04-2004, 08:45 PM
Just a remark to begin your link didn't seem to work properly.... the .zip

Thank you for your help, I will test this method, however could you give me some more info about these metadata...


Is it something you have to manually put for each flv before exporting flv or is something which is automatically added to the flv, if has been exported with the revised version?

I've found this :

ns.onMetaData = function ( info )
{
info.creationdate
info.framerate
info.audiodatarate
info.videodatarate
info.height
info.width
info.duration <-時間
};

are these properties all the meta data added to a flv with the 1.2 exporter?

is it possible to recognize a 1.2 exported flv from an older one?

Thank you one more time for your help!
Best regards.

petefs
11-04-2004, 10:17 PM
hm, just go to buraks.com and you can find it through there ^_^ Must have moved since I last typed the url in.

metadata is inserted automatically by the 1.2 exporter.
a 1.2 exported FLV is exactly the same as any other FLV -- except for the metadata. It's backwards/forwards compatible.

cheers ^_^

303 maddec
11-05-2004, 07:40 AM
Thank you for your help!

Ok I've found the injector ;)
There's also a GUI ;)

Best regards.

Kante
05-21-2007, 11:20 AM
instead of editing the original class and to keep easy fast record to what props and methods I have added, I use a "enhanced" names set of class, whitch contains all the extends I use (String, TextField, XML, etc)

This is just clearer and more efficient if I want to move to another computer : I just take my class folder (instead of having to select the right classes to copy it into the default Macromedia classes folder. -> just isn't a workflow)

Have fun!