Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Hi Jason,

that's true. Of course I could read out all metadata and store it into
an array or xml. It's the usual decision of flashdevelopers to have a
every-situation-solution vs. a best-for-this-project-solution, right?
;)

Thanks,
Matthias

On Jan 21, 2008 6:07 PM, Jason Van Cleave <[EMAIL PROTECTED]> wrote:
> you could use flvtool2 to get the metadata server-side and store it in a
> database
>
> http://www.inlet-media.de/
>
> flvtool2 -P Prints out meta data to stdout
>
>
> On Jan 21, 2008 11:31 AM, Glen Pike <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> >Have a look at these 2 possible things to combine / work-around
> > getting the meta-data & streaming via PHP.  It is a different thing
> > altogether, but you may be able to parse the FLV's and store the data in
> > XML or something?
> >
> >
> >
> > http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two
> >
> >http://getid3.sourceforge.net/
> >
> >Glen
> >
> > Matthias Dittgen wrote:
> > > Steven,
> > >
> > > I can't figure out a way to use ByteArray. I am able to load the flv
> > > as ByteArray, but I can't see a way to load this into a Netstream
> > > object. Any thought on that?
> > >
> > > private function load(url:String):void
> > > {
> > >   var loader:URLLoader = new URLLoader();
> > >   loader.addEventListener(Event.COMPLETE,completeHandler);
> > >   loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
> > >   loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR
> > ,errorHandler);
> > >   loader.dataFormat = URLLoaderDataFormat.BINARY;
> > >   loader.load(new URLRequest(url));
> > > }
> > >
> > > private function completeHandler(e:Event):void
> > > {
> > >   var loader:URLLoader = e.target as URLLoader;
> > >   trace(loader.data); // :-) how to go on from here?
> > > }
> > >
> > > Matthias
> > >
> > > On Jan 21, 2008 12:48 PM, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
> > >
> > >> Hello Steven,
> > >>
> > >> yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
> > >> and I wait even until  metadata are received, as mentioned earlier.
> > >> I have shut off the unwanted sound behavior now, but don't know, how I
> > did it.
> > >>
> > >> pause(false) ist AS2, Steven?
> > >> AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().
> > >>
> > >> Sure, we talk about flv from file and ns.play(urlToFile).
> > >>
> > >> I changed ns.bufferTime to a higher value, now.
> > >> That's everything I changed lately, and waiting for metadata seems to
> > >> become faster (can't explain). I know, that it'll take time to load
> > >> the header/metadata portion of a flv, Steven, but it felt to long.
> > >> Now, with bigger buffer time (sounds crazy, I know) it is much faster.
> > >>
> > >> I'll try the ByteArray idea...
> > >>
> > >> Regards,
> > >> Matthias
> > >>
> > >>
> > >> On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]>
> > wrote:
> > >>
> > >>> Glen,
> > >>>
> > >>> Unfortunately, I discovered a bug with the code I posted. The
> > >>> NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
> > >>> have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
> > >>> onProgress.
> > >>>
> > >>>
> > >>> Matthias,
> > >>>
> > >>> I have never had any unwanted sound behavior when I use:
> > >>>
> > >>> ns.play(src);
> > >>> ns.pause(true);
> > >>>
> > >>> If you are hearing an audio blip, it's simple to fix by applying a
> > >>> SoundTransform with the volume set to 0 before you play/pause the
> > NetStream.
> > >>>
> > >>> var transform:SoundTransform = ns.soundTransform;
> > >>> transform.volume = 0;
> > >>> ns.soundTransform = transform;
> > >>> ns.play(src);
> > >>> ns.pause(true);
> > >>>
> > >>> For the sake of this discussion, I'm going to assume we're talking
> > about
> > >>> progressive downloads as opposed to FLVs streamed from FMS.
> > >>>
> > >>> You cannot attach a single NetStream to multiple Video instances.
> > >>>
> > >>> If you fully load an FLV and caching is turned on (never a guarantee,
> > >>> but likely) then the FLV will load instantly for the next NetStream
> > that
> > >>> loads it.  HOWEVER, if it is not cached and you start a second
> > NetStream
> > >>> to load the same FLV before it is finished loading, it will load the
> > >>> entire file again since it's technically not cached according to the
> > >>> browser.
> > >>>
> > >>> I disagree that waiting for metadata is "really ugly".  How is any
> > >>> client, Flash or otherwise, supposed to know anything about a file
> > it's
> > >>> loading before it starts loading it?  The only way it could is if you
> > >>> hard-code it ahead of time because you know what it is.
> > >>>
> > >>> If you're waiting for Flash to determine it dynamically, it has to
> > >>> access the file to get the header information (metadata) that
> > describes
> > >>> the FLV.  Because you can play/pause, the metadata can come before you
> > >>> even addChild() the 

Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Hi Glen,

i am somewhat satisfied with my current solution, now, but this is a
really interesting ressource you mentioned! Thanks for sharing!

Matthias

On Jan 21, 2008 5:31 PM, Glen Pike <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Have a look at these 2 possible things to combine / work-around
> getting the meta-data & streaming via PHP.  It is a different thing
> altogether, but you may be able to parse the FLV's and store the data in
> XML or something?
>
>
> http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two
>
> http://getid3.sourceforge.net/
>
> Glen
>
>
> Matthias Dittgen wrote:
> > Steven,
> >
> > I can't figure out a way to use ByteArray. I am able to load the flv
> > as ByteArray, but I can't see a way to load this into a Netstream
> > object. Any thought on that?
> >
> > private function load(url:String):void
> > {
> >   var loader:URLLoader = new URLLoader();
> >   loader.addEventListener(Event.COMPLETE,completeHandler);
> >   loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
> >   
> > loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
> >   loader.dataFormat = URLLoaderDataFormat.BINARY;
> >   loader.load(new URLRequest(url));
> > }
> >
> > private function completeHandler(e:Event):void
> > {
> >   var loader:URLLoader = e.target as URLLoader;
> >   trace(loader.data); // :-) how to go on from here?
> > }
> >
> > Matthias
> >
> > On Jan 21, 2008 12:48 PM, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
> >
> >> Hello Steven,
> >>
> >> yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
> >> and I wait even until  metadata are received, as mentioned earlier.
> >> I have shut off the unwanted sound behavior now, but don't know, how I did 
> >> it.
> >>
> >> pause(false) ist AS2, Steven?
> >> AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().
> >>
> >> Sure, we talk about flv from file and ns.play(urlToFile).
> >>
> >> I changed ns.bufferTime to a higher value, now.
> >> That's everything I changed lately, and waiting for metadata seems to
> >> become faster (can't explain). I know, that it'll take time to load
> >> the header/metadata portion of a flv, Steven, but it felt to long.
> >> Now, with bigger buffer time (sounds crazy, I know) it is much faster.
> >>
> >> I'll try the ByteArray idea...
> >>
> >> Regards,
> >> Matthias
> >>
> >>
> >> On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]> wrote:
> >>
> >>> Glen,
> >>>
> >>> Unfortunately, I discovered a bug with the code I posted. The
> >>> NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
> >>> have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
> >>> onProgress.
> >>>
> >>>
> >>> Matthias,
> >>>
> >>> I have never had any unwanted sound behavior when I use:
> >>>
> >>> ns.play(src);
> >>> ns.pause(true);
> >>>
> >>> If you are hearing an audio blip, it's simple to fix by applying a
> >>> SoundTransform with the volume set to 0 before you play/pause the 
> >>> NetStream.
> >>>
> >>> var transform:SoundTransform = ns.soundTransform;
> >>> transform.volume = 0;
> >>> ns.soundTransform = transform;
> >>> ns.play(src);
> >>> ns.pause(true);
> >>>
> >>> For the sake of this discussion, I'm going to assume we're talking about
> >>> progressive downloads as opposed to FLVs streamed from FMS.
> >>>
> >>> You cannot attach a single NetStream to multiple Video instances.
> >>>
> >>> If you fully load an FLV and caching is turned on (never a guarantee,
> >>> but likely) then the FLV will load instantly for the next NetStream that
> >>> loads it.  HOWEVER, if it is not cached and you start a second NetStream
> >>> to load the same FLV before it is finished loading, it will load the
> >>> entire file again since it's technically not cached according to the
> >>> browser.
> >>>
> >>> I disagree that waiting for metadata is "really ugly".  How is any
> >>> client, Flash or otherwise, supposed to know anything about a file it's
> >>> loading before it starts loading it?  The only way it could is if you
> >>> hard-code it ahead of time because you know what it is.
> >>>
> >>> If you're waiting for Flash to determine it dynamically, it has to
> >>> access the file to get the header information (metadata) that describes
> >>> the FLV.  Because you can play/pause, the metadata can come before you
> >>> even addChild() the video to the display stack.
> >>>
> >>> I don't see how any of this could be considered "really ugly" but if you
> >>> do end up writing a psychic script that can determine a file's header
> >>> data without ever accessing the file, be sure to let us know.  ;)
> >>>
> >>> The ByteArray idea might work, I've never tried it, and it would
> >>> probably take you anywhere from 5-15 minutes to try it out.  I'm not
> >>> sure what benefit it would provide you other than guaranteeing that it
> >>> would be stored in memory if browser cache was turned off.  At best, you
> >

Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Jason Van Cleave
you could use flvtool2 to get the metadata server-side and store it in a
database

http://www.inlet-media.de/

flvtool2 -P Prints out meta data to stdout

On Jan 21, 2008 11:31 AM, Glen Pike <[EMAIL PROTECTED]> wrote:

> Hi,
>
>Have a look at these 2 possible things to combine / work-around
> getting the meta-data & streaming via PHP.  It is a different thing
> altogether, but you may be able to parse the FLV's and store the data in
> XML or something?
>
>
>
> http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two
>
>http://getid3.sourceforge.net/
>
>Glen
>
> Matthias Dittgen wrote:
> > Steven,
> >
> > I can't figure out a way to use ByteArray. I am able to load the flv
> > as ByteArray, but I can't see a way to load this into a Netstream
> > object. Any thought on that?
> >
> > private function load(url:String):void
> > {
> >   var loader:URLLoader = new URLLoader();
> >   loader.addEventListener(Event.COMPLETE,completeHandler);
> >   loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
> >   loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR
> ,errorHandler);
> >   loader.dataFormat = URLLoaderDataFormat.BINARY;
> >   loader.load(new URLRequest(url));
> > }
> >
> > private function completeHandler(e:Event):void
> > {
> >   var loader:URLLoader = e.target as URLLoader;
> >   trace(loader.data); // :-) how to go on from here?
> > }
> >
> > Matthias
> >
> > On Jan 21, 2008 12:48 PM, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
> >
> >> Hello Steven,
> >>
> >> yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
> >> and I wait even until  metadata are received, as mentioned earlier.
> >> I have shut off the unwanted sound behavior now, but don't know, how I
> did it.
> >>
> >> pause(false) ist AS2, Steven?
> >> AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().
> >>
> >> Sure, we talk about flv from file and ns.play(urlToFile).
> >>
> >> I changed ns.bufferTime to a higher value, now.
> >> That's everything I changed lately, and waiting for metadata seems to
> >> become faster (can't explain). I know, that it'll take time to load
> >> the header/metadata portion of a flv, Steven, but it felt to long.
> >> Now, with bigger buffer time (sounds crazy, I know) it is much faster.
> >>
> >> I'll try the ByteArray idea...
> >>
> >> Regards,
> >> Matthias
> >>
> >>
> >> On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]>
> wrote:
> >>
> >>> Glen,
> >>>
> >>> Unfortunately, I discovered a bug with the code I posted. The
> >>> NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
> >>> have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
> >>> onProgress.
> >>>
> >>>
> >>> Matthias,
> >>>
> >>> I have never had any unwanted sound behavior when I use:
> >>>
> >>> ns.play(src);
> >>> ns.pause(true);
> >>>
> >>> If you are hearing an audio blip, it's simple to fix by applying a
> >>> SoundTransform with the volume set to 0 before you play/pause the
> NetStream.
> >>>
> >>> var transform:SoundTransform = ns.soundTransform;
> >>> transform.volume = 0;
> >>> ns.soundTransform = transform;
> >>> ns.play(src);
> >>> ns.pause(true);
> >>>
> >>> For the sake of this discussion, I'm going to assume we're talking
> about
> >>> progressive downloads as opposed to FLVs streamed from FMS.
> >>>
> >>> You cannot attach a single NetStream to multiple Video instances.
> >>>
> >>> If you fully load an FLV and caching is turned on (never a guarantee,
> >>> but likely) then the FLV will load instantly for the next NetStream
> that
> >>> loads it.  HOWEVER, if it is not cached and you start a second
> NetStream
> >>> to load the same FLV before it is finished loading, it will load the
> >>> entire file again since it's technically not cached according to the
> >>> browser.
> >>>
> >>> I disagree that waiting for metadata is "really ugly".  How is any
> >>> client, Flash or otherwise, supposed to know anything about a file
> it's
> >>> loading before it starts loading it?  The only way it could is if you
> >>> hard-code it ahead of time because you know what it is.
> >>>
> >>> If you're waiting for Flash to determine it dynamically, it has to
> >>> access the file to get the header information (metadata) that
> describes
> >>> the FLV.  Because you can play/pause, the metadata can come before you
> >>> even addChild() the video to the display stack.
> >>>
> >>> I don't see how any of this could be considered "really ugly" but if
> you
> >>> do end up writing a psychic script that can determine a file's header
> >>> data without ever accessing the file, be sure to let us know.  ;)
> >>>
> >>> The ByteArray idea might work, I've never tried it, and it would
> >>> probably take you anywhere from 5-15 minutes to try it out.  I'm not
> >>> sure what benefit it would provide you other than guaranteeing that it
> >>> would be stored in memory if browser cache was turned off.  At best,
> yo

Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Glen Pike

Hi,

   Have a look at these 2 possible things to combine / work-around 
getting the meta-data & streaming via PHP.  It is a different thing 
altogether, but you may be able to parse the FLV's and store the data in 
XML or something?


   
http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two


   http://getid3.sourceforge.net/

   Glen

Matthias Dittgen wrote:

Steven,

I can't figure out a way to use ByteArray. I am able to load the flv
as ByteArray, but I can't see a way to load this into a Netstream
object. Any thought on that?

private function load(url:String):void
{
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,completeHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.load(new URLRequest(url));
}

private function completeHandler(e:Event):void
{
var loader:URLLoader = e.target as URLLoader;
trace(loader.data); // :-) how to go on from here?
}

Matthias

On Jan 21, 2008 12:48 PM, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
  

Hello Steven,

yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
and I wait even until  metadata are received, as mentioned earlier.
I have shut off the unwanted sound behavior now, but don't know, how I did it.

pause(false) ist AS2, Steven?
AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().

Sure, we talk about flv from file and ns.play(urlToFile).

I changed ns.bufferTime to a higher value, now.
That's everything I changed lately, and waiting for metadata seems to
become faster (can't explain). I know, that it'll take time to load
the header/metadata portion of a flv, Steven, but it felt to long.
Now, with bigger buffer time (sounds crazy, I know) it is much faster.

I'll try the ByteArray idea...

Regards,
Matthias


On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]> wrote:


Glen,

Unfortunately, I discovered a bug with the code I posted. The
NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
onProgress.


Matthias,

I have never had any unwanted sound behavior when I use:

ns.play(src);
ns.pause(true);

If you are hearing an audio blip, it's simple to fix by applying a
SoundTransform with the volume set to 0 before you play/pause the NetStream.

var transform:SoundTransform = ns.soundTransform;
transform.volume = 0;
ns.soundTransform = transform;
ns.play(src);
ns.pause(true);

For the sake of this discussion, I'm going to assume we're talking about
progressive downloads as opposed to FLVs streamed from FMS.

You cannot attach a single NetStream to multiple Video instances.

If you fully load an FLV and caching is turned on (never a guarantee,
but likely) then the FLV will load instantly for the next NetStream that
loads it.  HOWEVER, if it is not cached and you start a second NetStream
to load the same FLV before it is finished loading, it will load the
entire file again since it's technically not cached according to the
browser.

I disagree that waiting for metadata is "really ugly".  How is any
client, Flash or otherwise, supposed to know anything about a file it's
loading before it starts loading it?  The only way it could is if you
hard-code it ahead of time because you know what it is.

If you're waiting for Flash to determine it dynamically, it has to
access the file to get the header information (metadata) that describes
the FLV.  Because you can play/pause, the metadata can come before you
even addChild() the video to the display stack.

I don't see how any of this could be considered "really ugly" but if you
do end up writing a psychic script that can determine a file's header
data without ever accessing the file, be sure to let us know.  ;)

The ByteArray idea might work, I've never tried it, and it would
probably take you anywhere from 5-15 minutes to try it out.  I'm not
sure what benefit it would provide you other than guaranteeing that it
would be stored in memory if browser cache was turned off.  At best, you
might get a few milliseconds faster start-up loading from a ByteArray vs
from cache.


Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
gaia: http://www.gaiaflashframework.com


Matthias Dittgen wrote:
  

Hi Glen,

thanks, but that's exactly what I do, but it answers not the related questions:

a) what, if I need the video for a second DisplayObject at the same
time on stage, does it load faster, because it was cached?

b) play() and pause() leads to unwanted sound behaviors when the video
consists of sound

c) how to set the video to the real size? I always need to wait for
metadata, which is really ugly. Otherwise the video is set to default
320x480.

Any thoughts?

Is it perhaps possible to load the FLV as By

Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Steven,

I can't figure out a way to use ByteArray. I am able to load the flv
as ByteArray, but I can't see a way to load this into a Netstream
object. Any thought on that?

private function load(url:String):void
{
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,completeHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandler);
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.load(new URLRequest(url));
}

private function completeHandler(e:Event):void
{
var loader:URLLoader = e.target as URLLoader;
trace(loader.data); // :-) how to go on from here?
}

Matthias

On Jan 21, 2008 12:48 PM, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
> Hello Steven,
>
> yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
> and I wait even until  metadata are received, as mentioned earlier.
> I have shut off the unwanted sound behavior now, but don't know, how I did it.
>
> pause(false) ist AS2, Steven?
> AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().
>
> Sure, we talk about flv from file and ns.play(urlToFile).
>
> I changed ns.bufferTime to a higher value, now.
> That's everything I changed lately, and waiting for metadata seems to
> become faster (can't explain). I know, that it'll take time to load
> the header/metadata portion of a flv, Steven, but it felt to long.
> Now, with bigger buffer time (sounds crazy, I know) it is much faster.
>
> I'll try the ByteArray idea...
>
> Regards,
> Matthias
>
>
> On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]> wrote:
> > Glen,
> >
> > Unfortunately, I discovered a bug with the code I posted. The
> > NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
> > have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
> > onProgress.
> >
> >
> > Matthias,
> >
> > I have never had any unwanted sound behavior when I use:
> >
> > ns.play(src);
> > ns.pause(true);
> >
> > If you are hearing an audio blip, it's simple to fix by applying a
> > SoundTransform with the volume set to 0 before you play/pause the NetStream.
> >
> > var transform:SoundTransform = ns.soundTransform;
> > transform.volume = 0;
> > ns.soundTransform = transform;
> > ns.play(src);
> > ns.pause(true);
> >
> > For the sake of this discussion, I'm going to assume we're talking about
> > progressive downloads as opposed to FLVs streamed from FMS.
> >
> > You cannot attach a single NetStream to multiple Video instances.
> >
> > If you fully load an FLV and caching is turned on (never a guarantee,
> > but likely) then the FLV will load instantly for the next NetStream that
> > loads it.  HOWEVER, if it is not cached and you start a second NetStream
> > to load the same FLV before it is finished loading, it will load the
> > entire file again since it's technically not cached according to the
> > browser.
> >
> > I disagree that waiting for metadata is "really ugly".  How is any
> > client, Flash or otherwise, supposed to know anything about a file it's
> > loading before it starts loading it?  The only way it could is if you
> > hard-code it ahead of time because you know what it is.
> >
> > If you're waiting for Flash to determine it dynamically, it has to
> > access the file to get the header information (metadata) that describes
> > the FLV.  Because you can play/pause, the metadata can come before you
> > even addChild() the video to the display stack.
> >
> > I don't see how any of this could be considered "really ugly" but if you
> > do end up writing a psychic script that can determine a file's header
> > data without ever accessing the file, be sure to let us know.  ;)
> >
> > The ByteArray idea might work, I've never tried it, and it would
> > probably take you anywhere from 5-15 minutes to try it out.  I'm not
> > sure what benefit it would provide you other than guaranteeing that it
> > would be stored in memory if browser cache was turned off.  At best, you
> > might get a few milliseconds faster start-up loading from a ByteArray vs
> > from cache.
> >
> >
> > Steven Sacks
> > Flash Maestro
> > Los Angeles, CA
> > --
> > blog: http://www.stevensacks.net
> > gaia: http://www.gaiaflashframework.com
> >
> >
> > Matthias Dittgen wrote:
> > > Hi Glen,
> > >
> > > thanks, but that's exactly what I do, but it answers not the related 
> > > questions:
> > >
> > > a) what, if I need the video for a second DisplayObject at the same
> > > time on stage, does it load faster, because it was cached?
> > >
> > > b) play() and pause() leads to unwanted sound behaviors when the video
> > > consists of sound
> > >
> > > c) how to set the video to the real size? I always need to wait for
> > > metadata, which is really ugly. Otherwise the video is set to default
> > > 320x480.
> > >
> > > Any thoughts?
> > >
> > > Is it perhaps possible to load the FLV as ByteArray and later load

Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Hello Steven,

yes, I noticed that. I am waiting for ns.bytesLoaded == ns.bytesTotal,
and I wait even until  metadata are received, as mentioned earlier.
I have shut off the unwanted sound behavior now, but don't know, how I did it.

pause(false) ist AS2, Steven?
AS3/FlexBuilder doesn't allow me to have parameters for ns.pause().

Sure, we talk about flv from file and ns.play(urlToFile).

I changed ns.bufferTime to a higher value, now.
That's everything I changed lately, and waiting for metadata seems to
become faster (can't explain). I know, that it'll take time to load
the header/metadata portion of a flv, Steven, but it felt to long.
Now, with bigger buffer time (sounds crazy, I know) it is much faster.

I'll try the ByteArray idea...

Regards,
Matthias

On Jan 21, 2008 12:07 PM, Steven Sacks <[EMAIL PROTECTED]> wrote:
> Glen,
>
> Unfortunately, I discovered a bug with the code I posted. The
> NetStream.Buffer.Flush does not fire if the NetStream is paused.  You
> have to check to see if the ns.bytesLoaded == ns.bytesTotal in the
> onProgress.
>
>
> Matthias,
>
> I have never had any unwanted sound behavior when I use:
>
> ns.play(src);
> ns.pause(true);
>
> If you are hearing an audio blip, it's simple to fix by applying a
> SoundTransform with the volume set to 0 before you play/pause the NetStream.
>
> var transform:SoundTransform = ns.soundTransform;
> transform.volume = 0;
> ns.soundTransform = transform;
> ns.play(src);
> ns.pause(true);
>
> For the sake of this discussion, I'm going to assume we're talking about
> progressive downloads as opposed to FLVs streamed from FMS.
>
> You cannot attach a single NetStream to multiple Video instances.
>
> If you fully load an FLV and caching is turned on (never a guarantee,
> but likely) then the FLV will load instantly for the next NetStream that
> loads it.  HOWEVER, if it is not cached and you start a second NetStream
> to load the same FLV before it is finished loading, it will load the
> entire file again since it's technically not cached according to the
> browser.
>
> I disagree that waiting for metadata is "really ugly".  How is any
> client, Flash or otherwise, supposed to know anything about a file it's
> loading before it starts loading it?  The only way it could is if you
> hard-code it ahead of time because you know what it is.
>
> If you're waiting for Flash to determine it dynamically, it has to
> access the file to get the header information (metadata) that describes
> the FLV.  Because you can play/pause, the metadata can come before you
> even addChild() the video to the display stack.
>
> I don't see how any of this could be considered "really ugly" but if you
> do end up writing a psychic script that can determine a file's header
> data without ever accessing the file, be sure to let us know.  ;)
>
> The ByteArray idea might work, I've never tried it, and it would
> probably take you anywhere from 5-15 minutes to try it out.  I'm not
> sure what benefit it would provide you other than guaranteeing that it
> would be stored in memory if browser cache was turned off.  At best, you
> might get a few milliseconds faster start-up loading from a ByteArray vs
> from cache.
>
>
> Steven Sacks
> Flash Maestro
> Los Angeles, CA
> --
> blog: http://www.stevensacks.net
> gaia: http://www.gaiaflashframework.com
>
>
> Matthias Dittgen wrote:
> > Hi Glen,
> >
> > thanks, but that's exactly what I do, but it answers not the related 
> > questions:
> >
> > a) what, if I need the video for a second DisplayObject at the same
> > time on stage, does it load faster, because it was cached?
> >
> > b) play() and pause() leads to unwanted sound behaviors when the video
> > consists of sound
> >
> > c) how to set the video to the real size? I always need to wait for
> > metadata, which is really ugly. Otherwise the video is set to default
> > 320x480.
> >
> > Any thoughts?
> >
> > Is it perhaps possible to load the FLV as ByteArray and later load the
> > Netstream from this ByteArray, which might be faster and done a second
> > time, too?
> >
> > Matthias
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Steven Sacks

Glen,

Unfortunately, I discovered a bug with the code I posted. The 
NetStream.Buffer.Flush does not fire if the NetStream is paused.  You 
have to check to see if the ns.bytesLoaded == ns.bytesTotal in the 
onProgress.



Matthias,

I have never had any unwanted sound behavior when I use:

ns.play(src);
ns.pause(true);

If you are hearing an audio blip, it's simple to fix by applying a 
SoundTransform with the volume set to 0 before you play/pause the NetStream.


var transform:SoundTransform = ns.soundTransform;
transform.volume = 0;
ns.soundTransform = transform;
ns.play(src);
ns.pause(true);

For the sake of this discussion, I'm going to assume we're talking about 
progressive downloads as opposed to FLVs streamed from FMS.


You cannot attach a single NetStream to multiple Video instances.

If you fully load an FLV and caching is turned on (never a guarantee, 
but likely) then the FLV will load instantly for the next NetStream that 
loads it.  HOWEVER, if it is not cached and you start a second NetStream 
to load the same FLV before it is finished loading, it will load the 
entire file again since it's technically not cached according to the 
browser.


I disagree that waiting for metadata is "really ugly".  How is any 
client, Flash or otherwise, supposed to know anything about a file it's 
loading before it starts loading it?  The only way it could is if you 
hard-code it ahead of time because you know what it is.


If you're waiting for Flash to determine it dynamically, it has to 
access the file to get the header information (metadata) that describes 
the FLV.  Because you can play/pause, the metadata can come before you 
even addChild() the video to the display stack.


I don't see how any of this could be considered "really ugly" but if you 
do end up writing a psychic script that can determine a file's header 
data without ever accessing the file, be sure to let us know.  ;)


The ByteArray idea might work, I've never tried it, and it would 
probably take you anywhere from 5-15 minutes to try it out.  I'm not 
sure what benefit it would provide you other than guaranteeing that it 
would be stored in memory if browser cache was turned off.  At best, you 
might get a few milliseconds faster start-up loading from a ByteArray vs 
from cache.



Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
gaia: http://www.gaiaflashframework.com


Matthias Dittgen wrote:

Hi Glen,

thanks, but that's exactly what I do, but it answers not the related questions:

a) what, if I need the video for a second DisplayObject at the same
time on stage, does it load faster, because it was cached?

b) play() and pause() leads to unwanted sound behaviors when the video
consists of sound

c) how to set the video to the real size? I always need to wait for
metadata, which is really ugly. Otherwise the video is set to default
320x480.

Any thoughts?

Is it perhaps possible to load the FLV as ByteArray and later load the
Netstream from this ByteArray, which might be faster and done a second
time, too?

Matthias

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Hi Glen,

thanks, but that's exactly what I do, but it answers not the related questions:

a) what, if I need the video for a second DisplayObject at the same
time on stage, does it load faster, because it was cached?

b) play() and pause() leads to unwanted sound behaviors when the video
consists of sound

c) how to set the video to the real size? I always need to wait for
metadata, which is really ugly. Otherwise the video is set to default
320x480.

Any thoughts?

Is it perhaps possible to load the FLV as ByteArray and later load the
Netstream from this ByteArray, which might be faster and done a second
time, too?

Matthias


On Jan 21, 2008 10:52 AM, Glen Pike <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Steven Sacks posted this the other day.
>
> Glen
>
> "Preloading FLVs is easy peasy.
>
>
> var progressTimer:Timer = new Timer(10);
> progressTimer.addEventListener(TimerEvent.TIMER, updateProgress);
> var nc:NetConnection = new NetConnection();
> nc.connect(null);
> var ns:NetStream = new NetStream(nc);
> progressTimer.start();
> // PLAY IT THEN PAUSE IT
> ns.play(path);
> ns.pause(true);
>
> private function updateProgress($event:TimerEvent):void
> {
> dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false,
> false, ns.bytesLoaded, ns.bytesTotal));
> }
>
> private function onNetStreamStatus($event:NetStatusEvent):void
> {
> if ($event.info.code == "NetStream.Buffer.Flush")
> {
> progressTimer.stop();
> dispatchEvent(new Event(Event.COMPLETE));
>
> }
> } "
>
>
> Matthias Dittgen wrote:
> > Hello,
> >
> > I want to use video for character animations and so I want to preload
> > several videos without to play them while preloading.
> > How can I do this in AS3? I found only the play("something.flv")
> > method. Are there any other possibilities?
> >
> > Also, I am currently waiting for my metadata handler to be called
> > before I accept a video as loaded, because I need to set its height
> > and width, which only works using these values.
> > video.videoWidth and video.videoHeight doesn't work for me all the time.
> >
> > And because I have more than one charactor of its kind, do I need to
> > load the flv as often as many characters I have?
> >
> > Any suggestions?
> >
> > Matthias
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> >
>
> --
>
> Glen Pike
> 01736 759321
> www.glenpike.co.uk 
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Glen Pike

Hi,

   Steven Sacks posted this the other day.

   Glen

   "Preloading FLVs is easy peasy.


var progressTimer:Timer = new Timer(10);
progressTimer.addEventListener(TimerEvent.TIMER, updateProgress);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
progressTimer.start();
// PLAY IT THEN PAUSE IT
ns.play(path);
ns.pause(true);

private function updateProgress($event:TimerEvent):void
{
   dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, 
false, ns.bytesLoaded, ns.bytesTotal));

}

private function onNetStreamStatus($event:NetStatusEvent):void
{
   if ($event.info.code == "NetStream.Buffer.Flush")
   {
   progressTimer.stop();
   dispatchEvent(new Event(Event.COMPLETE));
   }
} "


Matthias Dittgen wrote:

Hello,

I want to use video for character animations and so I want to preload
several videos without to play them while preloading.
How can I do this in AS3? I found only the play("something.flv")
method. Are there any other possibilities?

Also, I am currently waiting for my metadata handler to be called
before I accept a video as loaded, because I need to set its height
and width, which only works using these values.
video.videoWidth and video.videoHeight doesn't work for me all the time.

And because I have more than one charactor of its kind, do I need to
load the flv as often as many characters I have?

Any suggestions?

Matthias
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01736 759321
www.glenpike.co.uk 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] load flv and its metadata without start to play

2008-01-21 Thread Matthias Dittgen
Hello,

I want to use video for character animations and so I want to preload
several videos without to play them while preloading.
How can I do this in AS3? I found only the play("something.flv")
method. Are there any other possibilities?

Also, I am currently waiting for my metadata handler to be called
before I accept a video as loaded, because I need to set its height
and width, which only works using these values.
video.videoWidth and video.videoHeight doesn't work for me all the time.

And because I have more than one charactor of its kind, do I need to
load the flv as often as many characters I have?

Any suggestions?

Matthias
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders