dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: srteaming swf video puzzle

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    11

    srteaming swf video puzzle

    Hi folks,
    I gotta really weird problem with flash video....(!)
    We have made a nice little flash player that loads a flash video(in the form of an swf exported from Sorenson Squeeze) and acts pretty much like a quicktime player (without the volume control).
    (For all those I have seen on this board looking for this kind of code, see below...)
    Trick is....after EXACTLY 2:41 mins (on all of our clips that are longer than 2:41) - the video image completely cuts out, while the sound plays perfectly!?

    Any ideas? We were wondering if it has something to do with the flash player not being able to handle information after a certain point....?
    2:41mins at 12 keyframes per second is 1932 keyframes which doesn't appear to mean anything...we're completely stumped, probably something really obvious!

    any help would really be appreciated!!


    here's our code:
    ------------------------------------------------
    MAIN CODE:

    loadSwf_mc.loadMovie("video/"+mySwf+".swf");
    controls_mc.play_btn.enabled = false;
    controls_mc.pause_btn.enabled = false;
    //
    vidXML = new XML();
    vidXML.ignoreWhite = true;
    vidXML.onLoad = function() {
    videoTxt = this.firstChild.childNodes;
    for (i = 0; i < videoTxt.length; i++) {
    title_mc.movieName = videoTxt[i];
    _root.time = videoTxt[i].attributes.time;
    }
    };
    vidXML.load("video/"+mySwf+".xml");

    //
    _root.createEmptyMovieClip("globalLode_mc", 14);
    globalLode_mc.onEnterFrame = function() {
    total = loadSwf_mc.getBytesTotal();
    loded = loadSwf_mc.getBytesLoaded();
    _global.perc = Math.round(100 * loded / total);
    };
    //
    _root.createEmptyMovieClip("globalVars_mc", 15);
    globalVars_mc.onEnterFrame = function() {
    _global.totFrame = loadSwf_mc._totalframes;
    _global.curFrame = loadSwf_mc._currentframe;
    loadSwf_mc._alpha = 10 * (curFrame - 1);
    _global.avFrame = Math.round(100 * curFrame / totFrame) + 1;
    };
    //
    _root.createEmptyMovieClip("bufferBar_mc", 16);
    bufferBar_mc.onEnterFrame = function() {
    controls_mc.buffer_mc.gotoAndStop(perc) + 1;
    };
    //
    _root.createEmptyMovieClip("playBar_mc", 17);
    playBar_mc.onEnterFrame = function() {
    controls_mc.playHead_mc.gotoAndStop(avFrame);
    };
    //
    _root.createEmptyMovieClip("arrowControl_mc", 18);
    arrowControl_mc.onEnterFrame = function() {
    myX = avFrame * 181 / 100;
    controls_mc.arrow_mc._x = myX;
    };
    //
    _global.dragHead = function(loc) {
    if (loc == "start") {
    if (_root.first) {
    _root.title_mc._visible = false;
    _root.first = false;
    }
    _root.arrowControl_mc.removeMovieClip();
    loadSwf_mc.stop();
    controls_mc.arrow_mc.startDrag(true, 4, 3, 181, 3);
    _root.createEmptyMovieClip("lodedDrag_mc", 19);
    _root.lodedDrag_mc.onEnterFrame = function() {
    avX = Math.round(100 * controls_mc.arrow_mc._x / 181);
    theFrame = Math.round(avX * (totFrame / 100));
    trace(avX + "* (" + totFrame + "/100)");
    loadSwf_mc.gotoAndStop(theFrame);
    };
    } else if (loc == "stop") {
    _root.lodedDrag_mc.removeMovieClip();
    controls_mc.arrow_mc.stopDrag();
    _root.createEmptyMovieClip("arrowControl_mc", 18);
    arrowControl_mc.onEnterFrame = function() {
    myX = avFrame * 181 / 100;
    controls_mc.arrow_mc._x = myX;
    };
    //loadSwf_mc.play();
    }
    };
    first = true;

    ---------------------------------------------
    DRAGHEAD CODE:

    on (press) {
    dragHead("start");
    }
    on (release) {
    dragHead("stop");
    }
    on (rollOver) {
    _root.controls_mc.arrow_mc.gotoAndStop(2);
    }
    on (rollOut) {
    _root.controls_mc.arrow_mc.gotoAndStop(1);
    }

    ------------------------------------------------
    PLay BUTTON CODE

    on (release) {
    _root.loadSwf_mc.play();
    if (_parent.first) {
    _parent.title_mc.gotoAndPlay("out");
    _parent.first = false;
    }
    }

    --------------------------------------------------
    pause button code (we chose separate play and pause unlike qt)
    on (release) {
    _root.loadSwf_mc.stop();
    }
    ---------------------------------------------------------
    grey

  2. #2
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    The only thing I can think of off hand is that the frame rate of your host movie and the frame rate of the imported .swf's are different. They should be the same or a factor of each other (eg: 12/24).

    Flash will sync the audio to the timeline of the host movie - so this may be causing the audio to continue playing while the video cuts out.

    Either way, sounds weird.

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Posts
    11

    streaming in a SWF video file

    Thanks Wheels.
    We tried this - but it wasn't it... then pulled out our hair and jumped on desks.... then found out what it was.............................. we forgot to plug the computer in.

    here's the new MAIN code refurbished and working properly - it's got a pause built in at the begginning that we needed that you can take out and some xml stuff we needed that can also be removed

    if someone kows a better way of making contols for streaming in a SWF video file we would love to see it!



    //------------ PAUSE -------------
    this.createEmptyMovieClip("timer",50);
    timer.onEnterFrame = function()
    {
    if (this.startTime>0)
    {
    var diff = getTimer()-this.startTime;
    if (diff>this.timerLength)
    {
    delete this.onEnterFrame;
    keepGoing();
    this.startTime = 0;
    }
    }
    }
    function pauseFor(theTime)
    {
    stop();
    timer.timerLength = theTime;
    timer.startTime = getTimer();
    timer.target = this;
    }
    //------------ PAUSE -------------

    controls_mc.play_btn.enabled = false;
    controls_mc.pause_btn.enabled = false;

    _global.keepGoing = function()
    {
    loadSwf_mc.loadMovie("video/"+mySwf+".swf");
    //
    vidXML = new XML();
    vidXML.ignoreWhite = true;
    vidXML.onLoad = function() {
    videoTxt = this.firstChild.childNodes;
    for (i = 0; i < videoTxt.length; i++) {
    title_mc.movieName = videoTxt[i];
    title_mc.play();
    _root.time = videoTxt[i].attributes.time;
    }
    };
    vidXML.load("video/"+mySwf+".xml");
    }


    // pause, if requested, or just go ahead and play
    if ( int(pauseSecs) > 0 )
    pauseFor( (pauseSecs) * 1000);
    else
    keepGoing();



    //
    _root.createEmptyMovieClip("globalLode_mc", 14);
    globalLode_mc.onEnterFrame = function() {
    total = loadSwf_mc.getBytesTotal();
    loded = loadSwf_mc.getBytesLoaded();
    _global.perc = Math.round(100 * loded / total);
    this.removeMovieClip();
    };
    //
    _root.createEmptyMovieClip("globalVars_mc", 15);
    globalVars_mc.onEnterFrame = function() {
    _global.totFrame = loadSwf_mc._totalframes;
    _global.curFrame = loadSwf_mc._currentframe;
    if ( loadSwf_mc._alpha <= 100 || curFrame <= 10)
    loadSwf_mc._alpha = 10 * (curFrame - 1);
    _global.avFrame = Math.round(100 * curFrame / totFrame) + 1;
    };
    //
    _root.createEmptyMovieClip("bufferBar_mc", 16);
    bufferBar_mc.onEnterFrame = function() {
    controls_mc.buffer_mc.gotoAndStop(perc) + 1;
    };
    //
    _root.createEmptyMovieClip("playBar_mc", 17);
    playBar_mc.onEnterFrame = function() {
    controls_mc.playHead_mc.gotoAndStop(avFrame);
    };
    //
    _root.createEmptyMovieClip("arrowControl_mc", 18);
    arrowControl_mc.onEnterFrame = function() {
    myX = avFrame * 181 / 100;
    controls_mc.arrow_mc._x = myX;
    };
    //
    _global.dragHead = function(loc) {
    if (loc == "start") {
    if (_root.first) {
    _root.title_mc._visible = false;
    _root.first = false;
    }
    _root.arrowControl_mc.removeMovieClip();
    loadSwf_mc.stop();
    controls_mc.arrow_mc.startDrag(true, 4, 3, 181, 3);
    _root.createEmptyMovieClip("lodedDrag_mc", 19);
    _root.lodedDrag_mc.onEnterFrame = function() {
    avX = Math.round(100 * controls_mc.arrow_mc._x / 181);
    theFrame = Math.round(avX * (totFrame / 100));
    trace(avX + "* (" + totFrame + "/100) = " + theFrame);
    loadSwf_mc.gotoAndStop(theFrame);
    };
    } else if (loc == "stop") {
    _root.lodedDrag_mc.removeMovieClip();
    controls_mc.arrow_mc.stopDrag();
    _root.createEmptyMovieClip("arrowControl_mc", 18);
    arrowControl_mc.onEnterFrame = function() {
    myX = avFrame * 181 / 100;
    controls_mc.arrow_mc._x = myX;
    };
    //loadSwf_mc.play();
    }
    };
    first = true;
    stop();
    grey

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