A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Start another buffering when the actual one has finished

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    14

    Thumbs up Start another buffering when the actual one has finished

    Hi

    Supponing that i've 3 FLV video and i want to reproduce it sequentially..
    I start loading the first video and while it playing his reach the 100% of buffer.. At this point i want to proceeed loading the second video (while the first are still playing)...

    For do this i need different netconnections and netstreams (one for each video that i want to load), or i can do this with only one of them?

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I don't know how large the videos are, but alternatively you could do video editing and join the videos to one. To load the videos you need new media objects including video objects. You can also try how fast the the videos load, if you don't preload.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    14
    Quote Originally Posted by cancerinform View Post
    I don't know how large the videos are, but alternatively you could do video editing and join the videos to one. To load the videos you need new media objects including video objects. You can also try how fast the the videos load, if you don't preload.
    no, i need the video splitted for a lot of causes

    What i want to know, i need a Video object + net connection + net stream for each of them, or i can recyle the same variables in some manner?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You cannot recycle them, because you are already loading the new videos when one is playing. You can only load one video at a time. So you need separate Video objects etc. However, are you sure you really need that, since loading and playing is very fast. So you could create something like this:
    PHP Code:
    var connection:NetConnection = new NetConnection();
    connection.addEventListener(NetStatusEvent.NET_STATUSnetStatusHandler);
    connection.connect(null);
    var 
    myfilmArray:Array = new Array("video1.flv","video2.flv","video3.flv");
    var 
    count:int 0;
    var 
    video:Video = new Video();
    addChild(video);
    function 
    netStatusHandler(event:NetStatusEvent):void
    {
        switch (
    event.info.code)
        {
            case 
    "NetConnection.Connect.Success" :
                
    connectStream(myfilmArray[count]);// function creates stream and 
                
    break;
            case 
    "NetStream.Play.Stop" :
                
    count++;
                if(
    count <= 2)
                {
                    
    connectStream(myfilmArray[count]);
                }
                break;
            case 
    "NetStream.Play.StreamNotFound" :
                
    trace("Unable to locate video: " myfilmArray[count];
                break;
        }
    }
    function 
    connectStream(videoURL):void
    {
        
    stream = new NetStream(connection);
        
    stream.addEventListener(NetStatusEvent.NET_STATUSnetStatusHandler);
        
    stream.play(videoURL);
        
    video.attachNetStream (stream);

    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    Jul 2011
    Posts
    14
    This is what i already do. Simple, when the "play" status of a video finishes, it load the next, but it's not what i want
    I want that the buffer of the next video starts when the buffer of the predecessor finishes, if the prev video still playing too.

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Then you need to have different objects for all three videos as I said and load the videos and pause them after loading, so they can immediately play when one video finishes. You also need to delete the video object after playing or make it invisible. You may be able to shuttle between two different sets. I am not sure you need a new Netconnection, but that you can test.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Junior Member
    Join Date
    Jul 2011
    Posts
    14
    or else i simple create two video objects with relative netconnection and netstreams, and swap alternately throught them
    The "three" number of video is indicative, indeed they can be much more and i won't occupy too much memory

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