[Flashcoders] Netstream fails to close

2008-07-03 Thread Barry Hannah
I'm trying to fix a bug in a video player.

Selecting a new video to play from a playlist, plays correctly but the
first clip's audio doesn't die.

I'm using NetStream.close(), it doesn't appear to work. It works if I
wait for the first clip to download fully, just not if I select a new
clip when the first is still loading.

 

HELP!

 

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


Re: [Flashcoders] Netstream fails to close

2008-07-05 Thread Jason Van Cleave
sounds like a scope issue where you have multiple netstream objects

On Thu, Jul 3, 2008 at 9:54 PM, Barry Hannah <[EMAIL PROTECTED]> wrote:

> I'm trying to fix a bug in a video player.
>
> Selecting a new video to play from a playlist, plays correctly but the
> first clip's audio doesn't die.
>
> I'm using NetStream.close(), it doesn't appear to work. It works if I
> wait for the first clip to download fully, just not if I select a new
> clip when the first is still loading.
>
>
>
> HELP!
>
>
>
> ___
> 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] Netstream fails to close

2008-07-05 Thread Steven Sacks

You have to pause() before you close().


Jason Van Cleave wrote:

sounds like a scope issue where you have multiple netstream objects

On Thu, Jul 3, 2008 at 9:54 PM, Barry Hannah <[EMAIL PROTECTED]> wrote:

  

I'm trying to fix a bug in a video player.

Selecting a new video to play from a playlist, plays correctly but the
first clip's audio doesn't die.

I'm using NetStream.close(), it doesn't appear to work. It works if I
wait for the first clip to download fully, just not if I select a new
clip when the first is still loading.



HELP!



___
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

  


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


RE: [Flashcoders] Netstream fails to close

2008-07-05 Thread Barry Hannah
Appreciate the responses.
Pause doesn't work.
There is only one netstream object instance so no scoping issue. It's a bona 
fide bug, I just want to know if anyone has a workaround/hack to beat it.
 



From: [EMAIL PROTECTED] on behalf of Steven Sacks
Sent: Sun 6/07/2008 6:00 a.m.
To: Flash Coders List
Subject: Re: [Flashcoders] Netstream fails to close



You have to pause() before you close().


Jason Van Cleave wrote:
> sounds like a scope issue where you have multiple netstream objects
>
> On Thu, Jul 3, 2008 at 9:54 PM, Barry Hannah <[EMAIL PROTECTED]> wrote:
>
>  
>> I'm trying to fix a bug in a video player.
>>
>> Selecting a new video to play from a playlist, plays correctly but the
>> first clip's audio doesn't die.
>>
>> I'm using NetStream.close(), it doesn't appear to work. It works if I
>> wait for the first clip to download fully, just not if I select a new
>> clip when the first is still loading.
>>
>>
>>
>> HELP!
>>
>>
>>
>> ___
>> 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
>
>  

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

Scanned by Bizo Email Filter



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


Re: [Flashcoders] Netstream fails to close

2008-07-05 Thread Steven Sacks
The only bug with NetStream that I know of is if you're spamming it with 
new streams too quickly.  The solution is to throttle the requests.


A safe time to wait between changing the streams is 250ms.

It's really simple to write a queueing system that does this.  You just 
overwrite the same variable and reset the timer.


var currentStream:String;
var timer:Timer = new Timer(250, 1);
timer.addEventListener(TimerEvent.TIMER, onTimerEvent);

function queueNewStream(value:String):void
{
   currentStream = value;
   timer.reset();
   timer.start();
}

function onTimerEvent(event:Event):void
{
   netStream.pause();
   netStream.close();
   netStream.load(currentStream);
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Netstream fails to close

2008-07-06 Thread Barry Hannah
It's mentioned by plenty of people here:
http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/ht
ml/wwhelp.htm?context=Flash_MX_2004&file=1594.html

here:
http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Ma
cromedia_Flash/Q_23515050.html

here:
http://forum.lighttpd.net/topic/72358

none of which have answers that work.

I could cast the sound onto a separate object and mute it, so that you
don't see or hear any ill effects, but my proxy tells me the flv is
still downloading, so if one of my clients users clicks on 10 video
clips their connection will crawl to a halt.

Anyone?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks
Sent: Sunday, 6 July 2008 9:41 a.m.
To: Flash Coders List
Subject: Re: [Flashcoders] Netstream fails to close

The only bug with NetStream that I know of is if you're spamming it with

new streams too quickly.  The solution is to throttle the requests.

A safe time to wait between changing the streams is 250ms.

It's really simple to write a queueing system that does this.  You just 
overwrite the same variable and reset the timer.

var currentStream:String;
var timer:Timer = new Timer(250, 1);
timer.addEventListener(TimerEvent.TIMER, onTimerEvent);

function queueNewStream(value:String):void
{
currentStream = value;
timer.reset();
timer.start();
}

function onTimerEvent(event:Event):void
{
netStream.pause();
netStream.close();
netStream.load(currentStream);
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Scanned by Bizo Email Filter


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


Re: [Flashcoders] Netstream fails to close

2008-07-08 Thread Jason Van Cleave
you probably have tried this but what happens if you don't pause or close
but just try to play another stream?

On Sun, Jul 6, 2008 at 4:43 PM, Barry Hannah <[EMAIL PROTECTED]> wrote:

> It's mentioned by plenty of people here:
> http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/ht
> ml/wwhelp.htm?context=Flash_MX_2004&file=1594.html<http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=1594.html>
>
> here:
> http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Ma
> cromedia_Flash/Q_23515050.html<http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23515050.html>
>
> here:
> http://forum.lighttpd.net/topic/72358
>
> none of which have answers that work.
>
> I could cast the sound onto a separate object and mute it, so that you
> don't see or hear any ill effects, but my proxy tells me the flv is
> still downloading, so if one of my clients users clicks on 10 video
> clips their connection will crawl to a halt.
>
> Anyone?
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Steven
> Sacks
> Sent: Sunday, 6 July 2008 9:41 a.m.
> To: Flash Coders List
> Subject: Re: [Flashcoders] Netstream fails to close
>
> The only bug with NetStream that I know of is if you're spamming it with
>
> new streams too quickly.  The solution is to throttle the requests.
>
> A safe time to wait between changing the streams is 250ms.
>
> It's really simple to write a queueing system that does this.  You just
> overwrite the same variable and reset the timer.
>
> var currentStream:String;
> var timer:Timer = new Timer(250, 1);
> timer.addEventListener(TimerEvent.TIMER, onTimerEvent);
>
> function queueNewStream(value:String):void
> {
>currentStream = value;
>timer.reset();
>timer.start();
> }
>
> function onTimerEvent(event:Event):void
> {
>netStream.pause();
>netStream.close();
>netStream.load(currentStream);
> }
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Scanned by Bizo Email Filter
>
>
> ___
> 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] Netstream fails to close

2008-07-08 Thread Steven Sacks

Barry,

FYI, I didn't just throw out an idea and pull some code out of my ass.  
I have tackled this exact issue for a client that needed to stop a 
stream from downloading when they closed the stream, and couldn't 
actually kill streams when the user interaction resulted in spamming new 
NetStreams.  The solution is to throttle the requests, using the exact 
code I provided.


If you're saying you call

ns.pause();
ns.close();
ns = null;

and the NetStream continues to download afterwards *when you do not 
attempt to open another NetStream*, then there's something else going on 
because that works.  If you immediately try to play another stream, even 
if it's not on same NetStream instance, then the previous one will not 
stop downloading (that's the bug).


When you throttle the requests for new streams, the problem goes away.

-Steven



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


Re: [Flashcoders] Netstream fails to close

2008-07-08 Thread Steven Sacks
And it's worth mentioning this works for AS3 Flash Player 9.0.47 only.  
It does not work for AS2.


The first link you provided was from 2004 with Flash Player 7.

The second link didn't look like it had any solution.

The third link shows how bad the bug is, and I'm well aware this was 
part of the problem.  You have to close the browser to kill the download 
if you get stuck downloading an flv because you didn't properly kill it.


However, if you call pause() first (which people assume, incorrectly, 
that you shouldn't have to do), then close(), then set the NetStream to 
null and then wait at least 250ms (I recommend 500ms) to play the next 
stream, you're good to go no matter what the MIME type is on the server.

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


Re: [Flashcoders] Netstream fails to close

2008-07-08 Thread Jon Bradley


On Jul 8, 2008, at 3:44 AM, Jason Van Cleave wrote:

I could cast the sound onto a separate object and mute it, so that  
you

don't see or hear any ill effects, but my proxy tells me the flv is
still downloading, so if one of my clients users clicks on 10 video
clips their connection will crawl to a halt.


First tip: use the video and sound classes instead of net stream.

Embed an 'empty' video object in your library with a linkage id. When  
you want to kill the stream, attach this video which will force the  
player to close any streaming connection. Then do what Steven said -  
and null out the stream elements. This will force it to close out.


I've seen the streams still stick around with 'just' pausing, closing  
and nulling out the stream connection. The only way I'm pretty sure  
it will work every time is by attaching this dummy vid.



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


RE: [Flashcoders] Netstream fails to close

2008-07-08 Thread Barry Hannah
FYI,
When I post to this list I'm openly and honestly explaining my
situation.
I would never suggest that someone with as much experience as yourself
'pulled code out of their ass'.
I have a fair bit of experience myself and it wasn't working for me.

The links I included were simply to illustrate that others had the same
difficulty. No they didn't have the answers, or I wouldn't have needed
to post here asking for help.

I was calling

ns.pause()
nz.close()

I wasn't setting the object to null or waiting x milliseconds. I didn't
want to re-instantiate the object. A delay was something I was
considering.

What it turned out to be was that in some other class in the same
sequence of events the NetConnection object instance was having it's
setServer method called *before* the ns.pause() and ns.close().
I rearranged the code and it worked. Streams terminate as they should.
Client is happy.

Seriously, thank-you for your help, I do appreciate it. There's no need
to get upset mate.

Barry.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks
Sent: Tuesday, 8 July 2008 8:36 p.m.
To: Flash Coders List
Subject: Re: [Flashcoders] Netstream fails to close

Barry,

FYI, I didn't just throw out an idea and pull some code out of my ass.  
I have tackled this exact issue for a client that needed to stop a 
stream from downloading when they closed the stream, and couldn't 
actually kill streams when the user interaction resulted in spamming new

NetStreams.  The solution is to throttle the requests, using the exact 
code I provided.

If you're saying you call

ns.pause();
ns.close();
ns = null;

and the NetStream continues to download afterwards *when you do not 
attempt to open another NetStream*, then there's something else going on

because that works.  If you immediately try to play another stream, even

if it's not on same NetStream instance, then the previous one will not 
stop downloading (that's the bug).

When you throttle the requests for new streams, the problem goes away.

-Steven



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

Scanned by Bizo Email Filter


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


RE: [Flashcoders] Netstream fails to close

2008-07-09 Thread Alexander, Mary
Does anyone have a solution for AS2? 



From: [EMAIL PROTECTED] on behalf of Steven Sacks
Sent: Tue 7/8/2008 4:46 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Netstream fails to close



And it's worth mentioning this works for AS3 Flash Player 9.0.47 only. 
It does not work for AS2.

The first link you provided was from 2004 with Flash Player 7.

The second link didn't look like it had any solution.

The third link shows how bad the bug is, and I'm well aware this was
part of the problem.  You have to close the browser to kill the download
if you get stuck downloading an flv because you didn't properly kill it.

However, if you call pause() first (which people assume, incorrectly,
that you shouldn't have to do), then close(), then set the NetStream to
null and then wait at least 250ms (I recommend 500ms) to play the next
stream, you're good to go no matter what the MIME type is on the server.
___
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] Netstream fails to close

2008-07-09 Thread Steven Sacks

Move to AS3.  ;)

Alexander, Mary wrote:
Does anyone have a solution for AS2? 

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


RE: [Flashcoders] Netstream fails to close

2008-07-09 Thread Kerry Thompson
Steven Sacks wrote

> Move to AS3.  ;)
> 
> Alexander, Mary wrote:
> > Does anyone have a solution for AS2?

LOL. One of the best pieces of advice I've seen on the lists!

You made my day, Steven.

Cordially,

Kerry Thompson

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


RE: [Flashcoders] Netstream fails to close

2008-07-10 Thread Alexander, Mary
We are moving to AS3 for new projects. Unfortunately, there is no time or money 
to redo this app in AS3 -- its stuck in AS2.



From: [EMAIL PROTECTED] on behalf of Kerry Thompson
Sent: Wed 7/9/2008 1:45 PM
To: 'Flash Coders List'
Subject: RE: [Flashcoders] Netstream fails to close



Steven Sacks wrote

> Move to AS3.  ;)
>
> Alexander, Mary wrote:
> > Does anyone have a solution for AS2?

LOL. One of the best pieces of advice I've seen on the lists!

You made my day, Steven.

Cordially,

Kerry Thompson

___
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