dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: FLVcomponent code not sequencing FLVs seamless

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    19

    FLVcomponent code not sequencing FLVs seamless

    The following code is an attempt to get a series of different FLVs to play seamlessly within one FLVcomponent.

    An ASCuePoint is created at 0.3 secs into the FLV, which then loads the next FLV into the other player (either 0 or 1).
    When each file finishes, code in the complete() eventListener switches the activeVideoPlayerIndex and the visibleVideoPlayerIndex to this other player with its by now loaded FLV. Then it plays it. Until the next ASCuePoint and the next FLV and the next complete() eventListener kicks in...

    The following code though produces two calls to the listenerObject.complete function before the cuepoint function instead of one. This is odd because the second call from the video player set in the cuepoint function hasn't started
    playing let alone finished playing. Why is it doing that?

    I have tried :

    -adding and removing the listener to avoid it being called again, but that didn't seem to work either.

    -closing the first Player

    This means the first player (0) keeps playing the same file while the other files cycle on the second player (1).
    So instead of :
    vp 0 plays video 1
    vp1 plays video 2
    vp 0 plays video3 etc

    I get :

    vp 0 plays video 1
    vp 1 plays video 2
    vp 0 plays video 1
    vp 1 plays video 3 etc

    Here's the code:


    Attach Code

    import mx.video.*;

    var shots=new Array("video_1.flv","video_2.flv","video_3.flv","v ideo_4.flv);
    var count:Number=0;

    //initial values for FLV component
    my_FLVPlybk.contentPath =shots[0];
    var cuePt:Object = new Object(); // create cue point object
    cuePt.time = 0.3;
    cuePt.name = "ASCue";
    cuePt.type = "actionscript";
    my_FLVPlybk.addASCuePoint(cuePt);

    var listenerObject:Object = new Object();
    listenerObject.ready = function(eventObject:Object):Void {
    trace("ready");
    };

    listenerObject.cuePoint = function(eventObject:Object):Void {
    if(eventObject.info.name=="ASCue"){
    trace("cuepoint");
    if(count<shots.length){
    count++;
    }else{
    count=0;}
    trace(shots[count]);

    if (eventObject.vp == 0) {
    my_FLVPlybk.activeVideoPlayerIndex = 1;
    }else{
    my_FLVPlybk.activeVideoPlayerIndex = 0;
    }

    my_FLVPlybk.load(shots[count]);
    my_FLVPlybk.autoRewind=true;
    my_FLVPlybk.stop();
    }
    my_FLVPlybk.addEventListener("complete", listenerObject); //used with removeEventListener
    //in listenerObject.complete function - makes no difference
    };

    listenerObject.complete = function(eventObject:Object):Void {
    trace("complete");
    trace("eventObject.vp :"+eventObject.vp);
    // if complete is for Ist FLV player, make default active and visible
    if (eventObject.vp == 1) {
    my_FLVPlybk.activeVideoPlayerIndex = 0;
    my_FLVPlybk.visibleVideoPlayerIndex = 0;
    //my_FLVPlybk.closeVideoPlayer(1);//makes no difference
    }
    else { // make 2nd player active & visible and play FLV
    my_FLVPlybk.activeVideoPlayerIndex = 1;
    my_FLVPlybk.visibleVideoPlayerIndex = 1;
    }
    my_FLVPlybk.play();
    //my_FLVPlybk.removeEventListener("complete",listene rObject); //makes no difference
    };

    my_FLVPlybk.addEventListener("ready", listenerObject);
    my_FLVPlybk.addEventListener("cuePoint", listenerObject);
    my_FLVPlybk.addEventListener("complete", listenerObject);

  2. #2
    Junior Member
    Join Date
    Aug 2002
    Posts
    19
    Found out my mistake:

    the actionscript cuepoints are wiped out, each time you set the contentPath anew. So in the cuepoint func you add it again:

    my_FLVPlybk.load(shots[count]);
    my_FLVPlybk.autoRewind=true;
    my_FLVPlybk.stop();
    my_FLVPlybk.addASCuePoint(cuePt); //added line

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