Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8313441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:29:31+00:00 2026-06-08T20:29:31+00:00

My project has a main loader that load all the assets for the project.

  • 0

My project has a main loader that load all the assets for the project. I need to load a bit of my video with it.

The video has 16mb, i want to load 3mb to use after the main loader is completed.

I’ve tried to open a new connection using Netconnection/Netstream to load 3mb and close the connection, but when the project starts and the video is played, a new connection is opened loading it from beginning.

I’m trying to find a way that i can use those 3mb already loaded. Doing this way, the user don’t need to wait a main loader and a secondary loader (buffertime).

That’s my code, sorry guys.

var loader:Loader = new Loader();

var nc:NetConnection = new NetConnection();
var ns:NetStream = new NetStream(nc);

var client:Object = new Object();

var swfRatio:Number;
var videoRatio:Number;

function init():void
{
    nc.connect(null);

    client.onCuePoint = cuePointHandler;
    client.onMetaData = metaDataHandler;

    ns.client = client;

    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressLoader);
    addEventListener(Event.ENTER_FRAME, progressTotal);

    loader.load(new URLRequest("swf/main.swf"));
    ns.play("f4v/main_movie.f4v");
    ns.pause();
}

function progressLoader(event:ProgressEvent):void
{               
    swfRatio = (event.bytesLoaded / event.bytesTotal);
}

function progressTotal():void
{
    //Here i get the amount that i want to preload from my video, in this case i want 3mb or 3072000 bytes
    videoRatio = (ns.bytesLoaded / 3072000);

    //This is a variable that i use to fill my loader asset and verify if my content its totaly loaded.
    var frameValue:int = ((videoRatio + swfRatio) / 2) * 100;

    if (frameValue >= 100)
    {
        removeEventListener(Event.ENTER_FRAME, progressTotal);
        // Here i close my connection, i suppose that i need to use the same connection in my player.
        ns.close();
        ns = null;
        nc.close();
        nc = null;
        loaderComplete();
    }
}

function loaderComplete():void
{
    removeChild(assetLoader);
    //Here i add my player to the stage, i want to use the preloaded video with him.
    addChild(loader.content);
}

function cuePointHandler(infoObject:Object):void {
    trace(infoObject.name);
}

function metaDataHandler(infoObject:Object):void {
    trace("metaData");
}

Then in my player that i’ve just loaded and added to the stage i’m using OSMF to help me with controls.

To test the “preloaded video” i’m doing this:

private var mediaPlayer:MediaPlayerSprite;

private function _init(e:Event):void
{
    this.removeEventListener(Event.ADDED_TO_STAGE, _init);

    mediaPlayer = new MediaPlayerSprite();
    addChild(mediaPlayer);  
    //And here OSMF start to load the entire main_movie.f4v again.
    mediaPlayer.resource = new URLResource("f4v/main_movie.f4v");   
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:29:33+00:00Added an answer on June 8, 2026 at 8:29 pm

    It looks like your strategy would work if you let the video download completely. I’m assuming if the video downloaded completely, the browser may cache it and make it available to the next NetStream that comes along.

    Your strategy looks OK otherwise. What you are doing (playing, then pausing the video immediately) is the way to start buffering the video. But since there are two NetStream‘s being used (one by the main loader, the other by the OSMF player) this won’t work.

    Perhaps you can devise a scheme where you pass the NetStream from the main loader into the loaded SWF (main.swf). So that it can use the data it’s already downloaded. Just a thought, I’ve never tried this.

    Another idea would be to get the OSMF player in your main.swf to do the buffering. That would mean the buffering would start happening only after main.swf is loaded (which may be too late).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The project currently has a UIviewController called Dashboard that acts as the main view
I'm working on a project for a firm that has their main solution in
Let's say that my project has a main class. I'd love to have public
I have the following situation. My project has a main.scala.html file and a folder
Can anyone help me find an up-to-date, working ATL project which has a main
I have the following project. The main form has control in it. This control
My project has some unit tests. They all depend on some external service, over
My project has multiple themes with different colors. I need to skin certain textboxes
Hey all. Something which has been bugging me quite a bit recently is this
I have a loader.exe with Main() that loads the 'UI' in WPF, the thing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.