Macromedia Flash Server - __nc.call()

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > May 2005 > __nc.call()





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author __nc.call()
Matthew Ganz

2005-05-25, 5:45 pm

hi.

i'm looking over another programmer's code and am trying to figure out
what this line of code is doing:

__nc.call( "getStreamLength", new Result(), video );

this is nested in this function here:

private function getStreamLength():Void
{
var parent = this;

video = __videoName;

function Result()
{
var parent = parent;
this.onResult = function( res )
{
parent.__playLength = Math.floor( res );
parent.getStream();
}
}
* __nc.call( "getStreamLength", new Result(), video );*
}

now i can trace out the video variable but for some reason, that line of
code in question isn't firing ( i can tell because the response object
isn't getting invoked -- i put a trace statement in there ).

i'm trying to understand what it's trying to do. is it reinvoking the
"getStreamLength" function, or...?? just trying to figure out where i
should begin debugging.

thank you.

matt.


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

hank williams

2005-05-25, 5:45 pm

Matt,

That line is calling a user written function on the (presumably)
connected flash communication server specified in the net connection
__nc. What I presume the programmer is doing is dealing with one of
those necessary but annoying facts about streamed files which is that
there is no built in function to ask the server how long a file is.
You have to write a server resident function and then call that
function and wait for the response to come back.

Regards
Hank

On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi.
>=20
> i'm looking over another programmer's code and am trying to figure out
> what this line of code is doing:
>=20
> __nc.call( "getStreamLength", new Result(), video );
>=20
> this is nested in this function here:
>=20
> private function getStreamLength():Void
> {
> var parent =3D this;
>=20
> video =3D __videoName;
>=20
> function Result()
> {
> var parent =3D parent;
> this.onResult =3D function( res )
> {
> parent.__playLength =3D Math.floor( res );
> parent.getStream();
> }
> }
> * __nc.call( "getStreamLength", new Result(), video );*
> }
>=20
> now i can trace out the video variable but for some reason, that line of
> code in question isn't firing ( i can tell because the response object
> isn't getting invoked -- i put a trace statement in there ).
>=20
> i'm trying to understand what it's trying to do. is it reinvoking the
> "getStreamLength" function, or...?? just trying to figure out where i
> should begin debugging.
>=20
> thank you.
>=20
> matt.
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Jordan Snyder

2005-05-25, 5:45 pm

If nothing is being returned, I would assume that the function
getStreamLength isn't defined on the server. Look at your main.asc on
the server for something like:

Client.prototype.getStreamLength =3D function() {
as;ldkfja;sldfkja;sldfkja;sldkfj }

or in the Application.onConnect() function, something like=20

client.getStreamLength =3D function()......

you get the idea.


If it's not defined, you can define it easily. All it does it take a
param and use Stream.length(streamName) to get a stream length in
seconds.


Client.prototype.getStreamLength =3D function(streamName)
{
=09myStreamLength =3D Stream.length(streamName);
=09this.call("receiveStreamLength",0, myStreamLength);
}

Cheers

On 5/25/05, hank williams <hank777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Matt,
>=20
> That line is calling a user written function on the (presumably)
> connected flash communication server specified in the net connection
> __nc. What I presume the programmer is doing is dealing with one of
> those necessary but annoying facts about streamed files which is that
> there is no built in function to ask the server how long a file is.
> You have to write a server resident function and then call that
> function and wait for the response to come back.
>=20
> Regards
> Hank
>=20
> On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
f[vbcol=seagreen]
>=20
> -----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> -----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20



--=20
Jordan Snyder
Applications Developer
ImageAction, USA
http://www.imageaction.com

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Matthew Ganz

2005-05-25, 5:45 pm

hi hank.

thanks for your quick response, i understand it now.

so i did get it to return a result but the strange thing is is that
every 3rd time or so i compile it returns a result of 0. and then maybe
it'll return 0 two times in a row.

all other times, it returns the correct length of the file. i'll go and
find that server-side function now to see if the problem is there.
otherwise, is there an explanation for why this might be happening?

thank you for lending a hand.

best,

matt.

hank williams wrote:

>Matt,
>
>That line is calling a user written function on the (presumably)
>connected flash communication server specified in the net connection
>__nc. What I presume the programmer is doing is dealing with one of
>those necessary but annoying facts about streamed files which is that
>there is no built in function to ask the server how long a file is.
>You have to write a server resident function and then call that
>function and wait for the response to come back.
>
>Regards
>Hank
>
>On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Jordan Snyder

2005-05-25, 5:45 pm

is it returning 0 length for the same file or are you using different
files? if different files, they might not be encoded with the correct
metadata. perhaps post the server side and client side code that
handle this interaction.




On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi hank.
>=20
> thanks for your quick response, i understand it now.
>=20
> so i did get it to return a result but the strange thing is is that
> every 3rd time or so i compile it returns a result of 0. and then maybe
> it'll return 0 two times in a row.
>=20
> all other times, it returns the correct length of the file. i'll go and
> find that server-side function now to see if the problem is there.
> otherwise, is there an explanation for why this might be happening?
>=20
> thank you for lending a hand.
>=20
> best,
>=20
> matt.
>=20
> hank williams wrote:
>=20
f[vbcol=seagreen]
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20



--=20
Jordan Snyder
Applications Developer
ImageAction, USA
http://www.imageaction.com

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Matthew Ganz

2005-05-25, 5:45 pm

hi.

i was just told that our FCS host doesn't allow us to write any
server-side code. but the getStreamLength() function is there so someone
must have written it, right?? -- and i'm testing with the same flv.

here's the output from the IDE when it does work:

getConnection()
net conn has been established
getStreamLength()
RESULT: 94.04 // length of .flv -- other times it returns RESULT: 0
getStream()
streamName: homePage
streamLength: 94

hank and jordan. thanks very much for your help. something must be going
on with our FCS host, i imagine.




Jordan Snyder wrote:

>is it returning 0 length for the same file or are you using different
>files? if different files, they might not be encoded with the correct
>metadata. perhaps post the server side and client side code that
>handle this interaction.
>
>
>
>
>On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
>
>
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

hank williams

2005-05-25, 5:45 pm

Well I would be curious whether you are always accessing the same file
or not. If it is not the same file then I would guess that sometimes
the file you are trying to access isnt there, so it returns a length
of 0.

If it is there, then it suggests something wierd is going on. Perhaps
sometimes it is not able to establish the netconnection, but in that
case the connect call should generate an error. I would also look at
the appInspector on the server side and see what it says is happening.
You should be able to see whether the server is doing the right thing.
You can even put a trace in the getStreamLength function to see if the
function is being called each time that you think it is.

Unfortunately, I dont have a silver bullet, but hope this helps.

Regards
Hank

On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi hank.
>=20
> thanks for your quick response, i understand it now.
>=20
> so i did get it to return a result but the strange thing is is that
> every 3rd time or so i compile it returns a result of 0. and then maybe
> it'll return 0 two times in a row.
>=20
> all other times, it returns the correct length of the file. i'll go and
> find that server-side function now to see if the problem is there.
> otherwise, is there an explanation for why this might be happening?
>=20
> thank you for lending a hand.
>=20
> best,
>=20
> matt.
>=20
> hank williams wrote:
>=20
f[vbcol=seagreen]
>=20
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

hank williams

2005-05-25, 5:45 pm

The call on the server side for getting the file length (I am
forgeting the exact call name) I am fairly sure doesnt use injected
metadata to figure out length so I dont think this would be the
problem.

Regards
Hank

On 5/25/05, Jordan Snyder <jordan.snyder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> is it returning 0 length for the same file or are you using different
> files? if different files, they might not be encoded with the correct
> metadata. perhaps post the server side and client side code that
> handle this interaction.
>=20
>=20
>=20
>=20
> On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
t[vbcol=seagreen]
of[vbcol=seagreen]
t[vbcol=seagreen]
>=20
>=20
> --
> Jordan Snyder
> Applications Developer
> ImageAction, USA
> http://www.imageaction.com
>=20
> -----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> -----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

hank williams

2005-05-25, 5:45 pm

Well, there is no getServerLength function built into flashcomm, so
either the programmer wrote it, or your service provider has a package
of routines that they provide for these kinds of things. For many apps
this function is needed, and if there is no way to program it and they
dont provide it, then I cant imagine how the service would be usable.
It sounds like you are using one of those streaming services like
vitalstream, and I think I remember reading somewhere that they do
provide their own library.

Regards
Hank

On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi.
>=20
> i was just told that our FCS host doesn't allow us to write any
> server-side code. but the getStreamLength() function is there so someone
> must have written it, right?? -- and i'm testing with the same flv.
>=20
> here's the output from the IDE when it does work:
>=20
> getConnection()
> net conn has been established
> getStreamLength()
> RESULT: 94.04 // length of .flv -- other times it returns RESULT: 0
> getStream()
> streamName: homePage
> streamLength: 94
>=20
> hank and jordan. thanks very much for your help. something must be going
> on with our FCS host, i imagine.
>=20
>=20
>=20
>=20
> Jordan Snyder wrote:
>=20
t[vbcol=seagreen]
of[vbcol=seagreen]
t[vbcol=seagreen]
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Jordan Snyder

2005-05-25, 5:45 pm

Hank,

I'd be interested to learn how Stream.length() does get that
information, since FCS doesn't have any special data storage areas of
its own.


Matt,

It sounds like your FCS host might provide that function as a general
utility, since it is so vital to FCS app creation. And if this is the
case, perhaps there is an issue with their code. You might try
getting a look at their code or even seeing if they have any
documentation on it...since they don't let you write your own apps,
surely they've given you at least a basic toolset.

Good luck!

Cheers


On 5/25/05, hank williams <hank777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The call on the server side for getting the file length (I am
> forgeting the exact call name) I am fairly sure doesnt use injected
> metadata to figure out length so I dont think this would be the
> problem.
>=20
> Regards
> Hank
>=20
> On 5/25/05, Jordan Snyder <jordan.snyder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
be[vbcol=seagreen]
nd[vbcol=seagreen]
t[vbcol=seagreen]
out[vbcol=seagreen]
ne of[vbcol=seagreen]
ect[vbcol=seagreen]
he[vbcol=seagreen]
i[vbcol=seagreen]
>=20
> -----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> -----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20



--=20
Jordan Snyder
Applications Developer
ImageAction, USA
http://www.imageaction.com

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Matthew Ganz

2005-05-25, 5:45 pm

that's exactly who i'm using and i'm calling them right now.

hank williams wrote:

>Well, there is no getServerLength function built into flashcomm, so
>either the programmer wrote it, or your service provider has a package
>of routines that they provide for these kinds of things. For many apps
>this function is needed, and if there is no way to program it and they
>dont provide it, then I cant imagine how the service would be usable.
>It sounds like you are using one of those streaming services like
>vitalstream, and I think I remember reading somewhere that they do
>provide their own library.
>
>Regards
>Hank
>
>On 5/25/05, Matthew Ganz <matt.ganz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

hank williams

2005-05-25, 5:45 pm

On 5/25/05, Jordan Snyder <jordan.snyder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hank,
>=20
> I'd be interested to learn how Stream.length() does get that
> information, since FCS doesn't have any special data storage areas of
> its own.
>=20
>


The only reason I am at all aware of this is because when I first
started working with flashcomm, I downloaded it from the MM website. I
did not realize that there was an upgrade "patcher" which needed to be
run on the app that they were allowing me to download. (this is
another story but the bottom line is, to this day, when you download
flashcomm you get the old version unless you patch it!)

Anyway, the old version did not support metadata injection, but you
could still get the length. I presume that inside the actual file
format (which is essentially h.263) that there is a way to look at the
file, and the length, and determine the running time. I do not
believe, for example that MP3 players need metadata in order to know
how long the song length is. I think that length information is baked
into the format or can be easily gleaned by some form of file
inspection based on data in the file. I imagine that most of these
media files are kind of like mini file systems in that they have some
kind of directory of pointers to blocks or segments into the file. I
know that FLV files have index data that is built into them (among
other things used for seeking) that I would expect could be used to
determine file length.

Regards
Hank

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com