A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to deal with SWF videos?

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    14
    I have four 10MBs mpg files converted to swfs. My client wants it to be in their site.

    Can it be streamed? Like it will play after downloading 1 MB of it.

    Can it be preloaded as an external SWFs? I remember that Flash 5 has problems in preloading external SWFs to Movie targets. Is it already solved in Flash MX?

    Please help...

  2. #2
    Junior Member
    Join Date
    Feb 2001
    Posts
    13

    using flash as qt movieplayer...

    Originally posted by ShapeTween
    I have four 10MBs mpg files converted to swfs. My client wants it to be in their site.

    Can it be streamed? Like it will play after downloading 1 MB of it.

    Can it be preloaded as an external SWFs? I remember that Flash 5 has problems in preloading external SWFs to Movie targets. Is it already solved in Flash MX?

    Please help...
    Hi,
    yes u can! see flash as a 750kb standalone qt player that acts like a normal movieclip; (compared to the 10mb qt player i dont think anyone would wanna use any other movie player..)

    Make a seperate swf containing your video track, and load this swf like any other swf with the loadmovie action in your main movie.

    When it is busy loading you can check the bytes loaded, but also the framesloaded, if u tell it to play right away it will probably be too soon so it will stall. try figure out how long it is going to take to finish (using time in ms of getdate() and bytesloaded).

    Start playing after the time to finish downloading is 10% less then the time it has to play.

    You can control the video just like any other swf/movieclip using gotoAndStop() or play, nextframe(); etc.

    U can also pan or set the volume of the video's audio but thats more complicated.

    Good luck,
    GuZ

    ps. with mpgs converting could prove tricky, because the audio and video arent seperate 'streams' if it doesnt work try making it avi or qt first.

    also u could use sorenson squeeze to automate it and for better quality.

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    8

    Re: using flash as qt movieplayer...

    [QUOTE]Originally posted by GuZtav
    When it is busy loading you can check the bytes loaded, but also the framesloaded, if u tell it to play right away it will probably be too soon so it will stall. try figure out how long it is going to take to finish (using time in ms of getdate() and bytesloaded).

    Start playing after the time to finish downloading is 10% less then the time it has to play.

    U can also pan or set the volume of the video's audio but thats more complicated.


    GuZtav,

    I too have been playing around with videos in flash MX but there are still a couple problems I had with it. Hope you can help me out because it seems you know your MX stuff!

    Here's the problem: I load a video-swf with
    loadMovie("_parent.video_.videoname.swf"), "_parent.video");

    but before that I try to call a frame which tracks the bytes loaded with video.getBytesLoaded()

    Problem is that flash immidiately tries to play the video and only displays the results of video.getBytesLoaded() after the video starts playing

    I also have problems with how to access the sound of a movieclip.

    Any help with this would be greatly appreciated.

  4. #4
    Junior Member
    Join Date
    Feb 2001
    Posts
    13

    Re: Re: using flash as qt movieplayer...

    hi, aint got no time ritenow but can help u a little meaby:

    use a stop(); in the swf containing the video (on first frame)

    (or use a myvideoswf.stop(); after the loadmovie command)

    check the framesloaded/totalframes() of the loading clip instead of bytes;

    and the sound object is more difficult: i spend one or two days fulltime figirung it out, but heres the general idea:

    make a new sound object targeting the video track of your imported swf; u ccan also try this in the video clip itself, but it will take a lot of time exporting each time, so u can best stick to loading an external swf containing your video;
    assuming u called ur video in the seperate swf 'videotrack'

    myvideosound=new Sound(myvideoswf.videotrack.video);
    myvideosound.setVolume(...);

    im not sure about the target, perhaps try remove the last .video, soon ill post my code for an audio panner of video..

    take care
    guz

  5. #5
    Junior Member
    Join Date
    Apr 2001
    Posts
    14
    Thanks GuZtav

    So the only way is to separate the video and the sound to make it stream?

    How can I play the movie after downloading 10% of it?

  6. #6
    Junior Member
    Join Date
    Feb 2001
    Posts
    13
    Originally posted by ShapeTween
    Thanks GuZtav

    So the only way is to separate the video and the sound to make it stream?

    How can I play the movie after downloading 10% of it?
    ouch, no forget all that

    ill just give a direct answer to your question 'how to make a video streamin':

    -swf files are always streaming. When you import a video into a layer it will spread over a number of frames, as soon as a frame is loaded it will display, but not faster then the frame rate. So if a frame is not laoded yet, the frame rate of the video can be lower then u want.
    In other words, YES, it starts playing before it is complety loaded.

    -however, it would be nice to pause the playing until the video has loaded enough frames to ensure uninterupted playback till the end.
    so then you make a small script that checks how much frames are loaded, and then starts playing:

    1. make a new document, import the video into the main time line;

    2. paste this code into frame 1:

    //--------------------
    // use an interval to find out how much is loaded
    // (replace 15 with your composition's framerate)
    checkloadIV = setInterval(checkload, 1000/15);
    // stop playing the video
    stop();
    //
    //the function called each interval
    function checkload () {
    loadpercent=_framesloaded/_totalframes;
    if (loadpercent==1) {
    clearInterval(checkloadIV);
    gotoAndPlay(2);
    }
    }
    //--------end---------


    you can try start playing after a percentage is loaded, try:
    if (loadpercent>=0.5) {...}
    to start playing after half of the movie is loaded.

    you should count how much loading time each frame takes to let the script predict when u could start playing.

    good luck!
    GuZ

  7. #7
    Junior Member
    Join Date
    May 2002
    Posts
    8
    thanks guys. I also figured out in the meantime that tracking the bytesloaded doesn't work locally.
    Now I can focus on the sound of the video. GuZtav let us know when you have the code, you know we'll all love you for it!

  8. #8
    Wildform Moderator
    Join Date
    Sep 2000
    Posts
    2,070
    Hi.
    You may want to check out our software, Flix, which converts most video formats into multiple types of swf's (MX, FLV, Flash 3-5 and vector). It comes with a number of useful features such as bitrate control and an automatic preloader setting.
    Samples and demos are available.
    best,
    jb
    http://www.wildform.com

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