A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Can you preload an f4v video?

  1. #1
    Running Plodding & Limping SpockBert's Avatar
    Join Date
    Jun 2002
    Location
    London
    Posts
    593

    Can you preload an f4v video?

    Can you preload an f4v video?

    My site design has a looping 10sec video in the background. As the video is crucial to the design (without it, there's an empty space!) I can't really have it doing a progressive download/stream.

    I'm using Flash CS5 and as2 (although happy to use as3 if I have to). At the moment I've gone import video, chosen my f4v and have it linked to a video component in the library. When the site is viewed online the standard .swf content appears then eventually after a delay the video shows up, hardly ideal!

    I don't know if its possible but I've love some way of preloading all the flash content AND the f4v video so the user doesn't see any content until its all ready to go. Other than embedding a lower quality .flv in the timeline I can't see a way round this :-(

    I've looked around but couldn't see anything relevant, can anyone help? Is it actually possible to preload an f4v?

    Many thanks!

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Short answer is yes, it is. Both the video object and FLVPlayback component have bytesLoaded and bytesTotal properties, same as the main movie does in AS2.

    So, you preload the main movie and at the same time you start loading the video, and add the two together, i.e. _root.getBytesTotal+movieInstance.getBytesTotal and _root.getBytesLoaded+movieInstance.getBytesLoaded when the two are equal, play.

  3. #3
    Running Plodding & Limping SpockBert's Avatar
    Join Date
    Jun 2002
    Location
    London
    Posts
    593
    Hi There

    Thank you for your reply!

    I tried what you said, new file, imported video, chose my .f4v, got the FLVPlayback component on the stage, named the instance "my_test_vid" and put the following code on frame 1:

    vid_size = my_test_vid.getBytesTotal();

    trace(vid_size);


    Its always gives the value of vid_size as "78". I've tried several .f4vs, one of them is huge 3Mb but still that vid_size comes out as "78".

    I'm wondering if its measuring the size of the FLVComponent rather than the f4v.

    Maybe I've got something simple wrong...

    I don't suppose you could make a working .fla of this could you!?

    Once again, thanks for trying to help, thought I was on my own there!

  4. #4
    Senior Member
    Join Date
    Sep 2010
    Posts
    324
    Making visitors wait until the video download is complete really doesn't seem like such a good idea. After all, preloading doesn't really "preload" anything... it just makes you wait... think of it as "wait loading".
    Typically while "wait-loading", at least the viewer is given something to distract his attention from the fact that you are making him wait... a spinning clock.. percent countdown, whatever..
    How about taking a frame grab from your video, save as a jpg and display that as your background while the rest of the page and the video are being downloaded?
    So in the first frame of your Flash doc you have the image and the preloading actionscript... once BytesTotal is 100% ... go to frame 2 where the video starts to play. Seems much more user friendly than a blank page.
    Also if you are having trouble getting the correct BytesTotal... have you tried just hard coding it in, rather than using a function to try calculate the total?
    Best of luck!
    Video Man

  5. #5
    Running Plodding & Limping SpockBert's Avatar
    Join Date
    Jun 2002
    Location
    London
    Posts
    593
    Hey Video Man

    I take your comments on board but I'll have to respectfully disagree with you about the nature of pre-loading!

    For me you pre-load so you control exactly how the end user sees your content. Having the content load in bits and pieces might be fine for most sites but for what I'm trying to do would be completely unsuitable.

    I have a brief intro sequence (100% video!) that leads direct into a looping 10sec clip (video!) that IS the website, its more important than a mere moving background. It has to be played without interruptions in one big hit for the site to have any "wow factor". Its more like a DVD menu, I think that's the best way I can describe it. If I ever get this thing finished I'll show you and you'll know what I mean.

    As to the code, yes tried hard-coding the size of the video. But _root.getBytesLoaded() only gets non-video content and if I can't get rdoyle720's method of the Total bytes working, I can't see how the Loaded will work so I'm still stuck!!

  6. #6
    Senior Member
    Join Date
    Sep 2010
    Posts
    324
    Hey SpockBert,
    My main point about preloading is that it makes you wait... anyway you slice it. In this day of high speed Internet, the visitor expects to see something right away and not wait.
    If it's just a short clip and little or no audio, you might try embedding the video into the main timeline if you can't get the preloader to work. External video may not be the way to go.
    More info here also:
    http://help.adobe.com/en_US/AS2LCR/F...=00000421.html

    http://www.askapache.com/optimize/pr...flv-files.html

    http://stackoverflow.com/questions/7...actionscript-3

    http://www.greensock.com/loadermax/

    Best wishes,
    Video Man

  7. #7
    Running Plodding & Limping SpockBert's Avatar
    Join Date
    Jun 2002
    Location
    London
    Posts
    593
    Thanks man!

    That top link looks just the thing! Cheers :-)

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