A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Cancel a FLVPlayback.load()?

  1. #1
    Senior Member
    Join Date
    Jan 2006
    Posts
    133

    resolved [RESOLVED] Cancel a FLVPlayback.load()?

    All,

    Is there a way to cancel a FLVPlayback.load()?

    If you load a .flv into a FLVPlayback component, and then attempt to load a different .flv before the first has "finished", the first .flv appears to need to finish loading before the loading of the 2nd flv can be started.

    So, the READY event will actually be dispatched twice, and it also seems that it takes a bit longer to load the 2nd .flv, then it does if you wait until the 1st load has completed.

    Visually, there doesn't seem to be any ill effects... the FLVPlayback component will display the 2nd .flv and play it as expected. But, it does seem like not being able to STOP/CANCEL a large .flv from loading could be a drain on resources.

    For example:

    Actionscript Code:
    function onClick(e:MouseEvent):void{
        myFLVPlayback.source = "video_" + $i + ".flv";
        //myFLVPlayback.load("video_" + $i + ".flv");
        //myFLVPlayback.play("video_" + $i + ".flv");
       
        $i++;
    }

    myFLVPlayback.addEventListener(VideoEvent.READY, onReady);

    function onReady(e:VideoEvent):void{
        trace("onReady event dispatched:", $i);
    }

    In the above code, if you click the mouse 5 times very quickly, the output window will indicate that 5 different READY events have been dispatched:

    Actionscript Code:
    onReady event dispatched: 1
    onReady event dispatched: 2
    onReady event dispatched: 3
    onReady event dispatched: 4
    onReady event dispatched: 5

    I get this behaviour if I use either load(), play() or modify .source directly. This, to me, seems to indicate that the videos "queue" up and the 1st video has to finish loading before the subsequent call to load(), play() or source will be started... a seemingly undesireable behavior a drain on resources?

    So, is there a way to cancel the loading of a large video?

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    No idea if this will work, but seems like a similar problem: http://apdevblog.com/flvplayback-pro...ing-netstream/

  3. #3
    Senior Member
    Join Date
    Jan 2006
    Posts
    133
    Thanks, I thought I tried that, but trying again... seems to work.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center