12 Replies Latest reply on Nov 21, 2006 11:13 AM by Red Box New Media

    FLV Playlist

      I want to embed multiple *.flv files into my video however, after the first video has stopped playing, I want it to automatically start playing video two.

      Is this possible via actionscript for though any way that I havent looked at yet. At the moment, I've imported video a and video b (for ease) and my clients are forced to click a button to view clip #2.
        • 1. Re: FLV Playlist
          AnandMX Level 1
          try firing an event using onCuePoint where cuePoint refers to your last FLV end. else try using onComplete event as well but i think nCuePoint will be the best. go through flash documentation netStream class.
          1 person found this helpful
          • 2. Re: FLV Playlist
            Level 7
            I use the onStatus method on the NetStream class. Works great for me. I do
            something like this:


            --
            Dave -
            Head Developer
            www.blurredistinction.com
            Adobe Community Expert
            http://www.adobe.com/communities/experts/


            • 3. Re: FLV Playlist
              Level 7
              Arg... I hate when I do that.

              Here's what I do:

              ns.onStatus = function(infoObject:Object) {
              if (infoObject["code"] == "NetStream.Play.Stop") {
              videoCounter++;
              playVideo(videoCounter);
              }
              };

              --
              Dave -
              Head Developer
              www.blurredistinction.com
              Adobe Community Expert
              http://www.adobe.com/communities/experts/


              • 4. Re: FLV Playlist
                haha sorry guys I'm a complete newbie when it comes to flash actionscript...

                Would anybody mind walking it through me step by step?
                • 5. Re: FLV Playlist
                  Ah sorry I did what you did :P, I gather its something like this....

                  var VideoCounter = new Array();
                  VideoCounter[0] = "myVideo.flv";
                  VideoCounter[1] = "2ndVideo.flv";

                  ns.onStatus = function(infoObject:Object) {
                  if (infoObject["code"] == "NetStream.Play.Stop") {
                  videoCounter++;
                  playVideo(videoCounter);
                  }
                  };

                  correct?
                  • 6. Re: FLV Playlist
                    var VideoArray = new Array();
                    VideoArray[0] = "hanazono_flyover.flv";
                    VideoArray[1] = "report1.flv";

                    var currentVideo = 1;

                    my_video.play(VideoArray[currentVideo]);

                    my_video.onStatus = function(infoObject:Object) {
                    currentVideo++;
                    my_video.play(VideoArray[currentVideo]);
                    };

                    This is as far as i got...I'm kind of stuck now...

                    How do i trigger currentVideo++ when the video finishes?
                    • 7. Re: FLV Playlist
                      BAM! Solution!!!!

                      Thanks for your assistance, you atleast put me on the right track.

                      Add a flvPlayBack component to the stage and name it my_video

                      [code]
                      var VideoArray = new Array();
                      VideoArray[0] = "hanazono_flyover.flv";
                      VideoArray[1] = "report1.flv";

                      var currentVideo = 0;

                      my_video.play(VideoArray[currentVideo]);

                      var listenerObject:Object = new Object();
                      // listen for complete event; play new FLV
                      listenerObject.complete = function(eventObject:Object):Void {
                      currentVideo++;
                      my_video.play(VideoArray[currentVideo]);
                      };
                      my_video.addEventListener("complete", listenerObject);
                      [/code]
                      • 8. Re: FLV Playlist
                        german01
                        Hi:

                        I tried the script posted here for a set of 10 short videos. I want to play them one after the other in sequence. Here is the script I used. It only plays two of the 10 videos and then nothing else happens. Can you please share the correct script to play more than two videos?

                        var VideoArray = new Array();
                        VideoArray=["Q1.flv", "Q2.flv","Q3.flv", "Q4.flv", "Q5.flv", "Q6.flv", "Q7.flv", "Q8.flv", Q9.Flv", "Q10.flv"];


                        var currentVideo = 0;

                        my_video.play(VideoArray[currentVideo]);

                        var listenerObject:Object = new Object();
                        // listen for complete event; play new FLV
                        listenerObject.complete = function(eventObject:Object):Void {
                        currentVideo++;
                        my_video.play(VideoArray[currentVideo]);


                        };
                        my_video.addEventListener("complete", listenerObject);

                        German
                        1 person found this helpful
                        • 9. FLV Playlist
                          The following code worked fine for me (3 videos)....

                          Would you like the .fla file uploaded somewhere so you can see?

                          Excuse the basic documentation...an employee of mine is also learning actionscript.

                          /* Control the video */

                          /* Initalize all the videos in the playlist. These can be http addresses
                          or relative. Part1.flv will look in same folder as the swf for part1.flv*/

                          VideoArray = new Array();
                          VideoArray[0] = "part1.flv";
                          VideoArray[1] = "part2.flv";
                          VideoArray[2] = "part3.flv";

                          /* default the video to the first video in the playlist and automatically start playing */
                          var currentVideo = 0;

                          my_video.play(VideoArray[currentVideo]);


                          // Initalize the listener object
                          var listenerObject:Object = new Object();

                          // when the flv finishes playing a video....

                          listenerObject.complete = function(eventObject:Object):Void {
                          // Increment to the next video in the list
                          currentVideo++;

                          // begin playing the new video
                          my_video.play(VideoArray[currentVideo]);

                          };

                          /* Attach the listener object to the video */
                          my_video.addEventListener("complete", listenerObject);
                          • 10. Re: FLV Playlist
                            german01 Level 1
                            Medihouse

                            Thanks for replying. The script worked very well! I can see the 10 video clips playing one after the other.


                            The only issue I have is that the last video clip keeps looping and doesn't end.

                            1. Is there a way to loop all the way back to the first video clip?
                            2. Do you know how to synchronize dynamic text with each video clip?
                            These video clips are questions. So I would like the user read and listen to the question as the video plays. Any suggestions will be appreciated.

                            German

                            1 person found this helpful
                            • 11. Re: FLV Playlist
                              haha, that just so happens to be exactly why I was doing this (the dynamic text). Now I'm sure i've done it inefficiently, but this is my code.....

                              I'll add the code required to make it stop instead of keep looping....

                              I'm not 100% sure about it, experement for yourself a little, but you should have the jist of it.




                              VideoArray = new Array();
                              VideoArray[0] = "part1.flv";
                              VideoArray[1] = "part2.flv";
                              VideoArray[2] = "part3.flv";


                              var currentVideo = 0;
                              my_video.play(VideoArray[currentVideo]);


                              var listenerObject:Object = new Object();

                              listenerObject.complete = function(eventObject:Object):Void {
                              if (currentVideo < VideoArray.length) {
                              // Increment to the next video in the list
                              currentVideo++;

                              // begin playing the new video
                              my_video.play(VideoArray[currentVideo]);
                              };
                              };



                              my_video.addEventListener("complete", listenerObject);


                              /* End control of video */


                              // when the timer ticks....
                              countDown = function () {

                              switch(Math.round(my_video.playheadTime)) {
                              // Part 1 Slides and some combined for part 2
                              case 0:
                              if (my_video.contentPath == "part1.flv") {
                              myText.text = "1";
                              };
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "5";
                              };
                              break;
                              case 66:
                              if (my_video.contentPath == "part1.flv") {
                              myText.text = "2";
                              };
                              break;
                              case 179:
                              if (my_video.contentPath == "part1.flv") {
                              myText.text = "3";
                              };
                              break;
                              case 218:
                              if (my_video.contentPath == "part1.flv") {
                              myText.text = "4";
                              };
                              break;
                              case 83:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "6";
                              };
                              break;
                              case 128:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "7";
                              };
                              break;
                              case 309:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "8";
                              };
                              break;
                              case 521:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "9";
                              };
                              break;
                              case 700:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "10";
                              };
                              break;
                              case 1043:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "11";
                              };
                              break;
                              case 1190:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "12";
                              };
                              break;
                              case 1321:
                              if (my_video.contentPath == "part2.flv") {
                              myText.text = "13";
                              };
                              break;
                              };
                              /* DEBUG MODE!!! Will display current time and content path. Just remove comments
                              myText.text = Math.round(my_video.playheadTime) + " " + my_video.contentPath;
                              */
                              };

                              // Start the timer, 10ms intervals for accuracy
                              timer = setInterval(countDown, 10);

                              • 12. Re: FLV Playlist
                                Red Box New Media
                                Hi all - just wanted to add that this also works well if you just want to loop playback of a single FLV file. For example using the following code:

                                // Initalize the listener object
                                var listenerObject:Object = new Object();

                                // when the flv finishes playing a video....

                                listenerObject.complete = function(eventObject:Object):Void {

                                // begin playing the new video
                                memVidContainer.play();

                                };

                                /* Attach the listener object to the video */
                                memVidContainer.addEventListener("complete", listenerObject);

                                Just thought I'd add in my thoughts.

                                Cheers
                                Adam