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 the
> > > Netstream from this ByteArray, which might be faster and done a second
> > > time, too?
> > >
> > > Matthias
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders