4 Replies Latest reply on Aug 12, 2010 12:10 PM by Fuzzy Barsik

    How to buffer file sequence?

    Fuzzy Barsik Level 4

      Hello all from dummy in web-programming!

       

      So as to imitate streaming video playback from small personal website I need to play several short video files as a sequence.

      (For example, splitted into chapters in Adobe Encore web-DVD)

      However in default mode there are gaps in playing previous and next video.

      I would really appreciate if somebody could tell me how to organize buffering of those sequences so that videos are played smoothly.

        • 1. Re: How to buffer file sequence?
          rtalton Level 4

          You'll always have a gap between videos you play in the same player. For a work-around, I would try loading the second video in a hidden player, behind the one currently playing. When you get the "complete" event (the first video finishes playing), hide the first player, show the hidden player, and start the playback of the second video.

          • 2. Re: How to buffer file sequence?
            Fuzzy Barsik Level 4

            That's what I'm actually trying to do...

            However, I can't make the next player start loading file on it's initialisation (while previous one is playing video).

            And I'm still unable to find any suitable example to understand the correct syntax...

             

            P.S. Playing a file sequence in the same player has an advantage - user can 'seek' withing a movie...

            • 3. Re: How to buffer file sequence?
              rtalton Level 4

              You mean you cannot load the second video? Can you post some code?

              As to the advantage you mention, it is non-existent, since you cannot load more than one video at a time, you cannot seek within multiple movies.

              • 4. Re: How to buffer file sequence?
                Fuzzy Barsik Level 4

                No, I mean I cannot PRE-load (i.e. buffer) the next video in the thread, 'cos I'm unable to find proper example...

                 

                Here is some code:

                <?xml version='1.0' encoding='UTF-8'?>

                <s:Application xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundColor="#060503" creationComplete="application_creationCompleteHandler()" height="750" preloaderChromeColor="#060503" width="1000">

                      <fx:Script><![CDATA[

                 

                <? APPLICATION START HANDLER AND SOME BUTTONS HANDLERS HERE ?>

                 

                            protected function button_clickHandler_4():void

                            {

                                        var state:String = currentState;

                                        if ( state == 'Page1' ) {

                                             currentState='The_best_movie';

                                        }

                                        if ( state == 'A_bit_later_movie' ) {

                                             currentState='The_best_movie';

                                        }

                                        BestMovieStart.play();

                                        BestMoviePart001.play();

                            }

                 

                 

                            protected function button_clickHandler_5():void

                            {

                                        var state:String = currentState;

                                        if ( state == 'Page1' ) {

                                             currentState='A_bit_later_movie';

                                        }

                                        if ( state == 'The_best_movie' ) {

                                             currentState='A_bit_later_movie';

                                        }

                                        UnderConstraction.play();

                            }

                 

                           

                            protected function BestMovie001_completeHandler():void

                            {

                                  Sequence1.play();

                                  BestMoviePart002.play();

                            }

                 

                <? THE SAME HANDLERS FOR THE REST PARTS OF THE MOVIE, EXCLUDING FINAL ?>

                     

                            protected function Movie_completeHandler():void

                            {

                                  currentState='Page1';

                            }

                 

                                  ]]></fx:Script>

                      <s:states>

                            <s:State name="Start"/>

                            <s:State name="Page1"/>

                            <s:State name="A_bit_later_movie"/>

                            <s:State name="The_best_movie"/>

                      </s:states>

                      <fx:Declarations>

                            <s:Parallel id="Sequence1">

                                  <s:Parallel target="{MaldivesPart001}">

                                        <s:SetAction property="alpha" value="0"/>

                                  </s:Parallel>

                            </s:Parallel>

                 

                <? THE SAME SEQUENCES FOR THE REST PARTS OF THE MOVIE, EXCLUDING FINAL ?>

                 

                            <s:Parallel id="BestMovieStart">

                                  <s:Parallel target="{BestMoviePart001}">

                                        <s:SetAction property="alpha" value="1"/>

                                  </s:Parallel>

                                  <s:Parallel target="{BestMoviePart002}">

                                        <s:SetAction property="alpha" value="1"/>

                                  </s:Parallel>

                <? THE SAME ACTIONS FOR THE REST PARTS OF THE MOVIE ?>

                            </s:Parallel>

                      </fx:Declarations>

                 

                <? SETTING UP BACKGROUND AND BUTTONS HERE ?>

                 

                      <s:VideoDisplay autoPlay="false" blendMode="screen" height="600" id="UnderConstraction" includeIn="A_bit_later_movie" scaleMode="none" source="assets/movies/UnderConstruction/_UnderConstruction.f4v" d:userLabel="A bit later movie" width="800" x="100" y="1" complete="Movie_completeHandler()"/> 

                      <s:VideoDisplay autoPlay="false" blendMode="normal" height="450" id="MaldivesPart005" includeIn="The_best_movie" scaleMode="zoom" source="assets/movies/BestMovie/_BestMovie_999.f4v" d:userLabel="Remember Maldives 005" width="800" x="100" y="100" complete="Movie_completeHandler()"/>

                      <s:VideoDisplay autoPlay="false" blendMode="normal" height="450" id="MaldivesPart004" includeIn="The_best_movie" scaleMode="zoom" source="assets/movies/BestMovie/_BestMovie_998.f4v" d:userLabel="Remember Maldives 004" width="800" x="100" y="100" complete="BestMovie998_completeHandler()"/>

                <? THE SAME VideoDisplays FOR THE REST PARTS OF THE MOVIE ?>

                 

                      <s:transitions>

                <? TRANSITIONS HERE ?>

                      </s:transitions>

                </s:Application>

                 

                You may look at how it works here: http://barsik-international.narod.ru

                 

                Regard to inability to load several videos in one player, I think that literally you're right - it's seems about player skin...

                But Adobe Encore can simulate it (brief example is here: http://smart250571.narod.ru). User obviously can see the 'only' player and obviously can 'seek' within a movie...