15 Replies Latest reply on Jul 1, 2010 6:05 PM by Harry Kunz

    FLV

    Harry Kunz Level 4

      Do i need to use the FLV playback component to load FLV files or can i load FLV files using loadMovie and use them like loaded SWF files? Can FLV files be loaded using ActionScript 1?

       

      I searched for simple examples on how to load an FLV but i can't find any examples... can someone please post an example?

        • 1. Re: FLV
          kglad Adobe Community Professional & MVP

          you can't load an flv like a swf.

           

          you can diplay an flv in flash using the flvplayback component or using the netstream class.

           

          i don't think you can use as1 to play an flv.

          1 person found this helpful
          • 2. Re: FLV
            Petro O. Bochan Level 3

            You can use AS1 to "load" an FLV file. If you opt for using FMS then you are good to go with Flash Player 6, but if no FMS available you might try using progressive download which requires at least Flash Player 7.

            • 3. Re: FLV
              Harry Kunz Level 4

              Hi kglad, i don't want to use the flv playback component. i just need the video so i used the NetStream and NetConnection classes:

               

              var oNc:NetConnection = new NetConnection();

              oNc.connect(null);

              var oNetStrem:NetStream = new NetStream(oNc);

              var f = myflv.videoPlayer.attachVideo(oNetStrem);

              oNetStrem.play("mymovie.flv");

              oNetStrem.seek(0);

              oNetStrem.pause();

               

              i used the last 3 line code coz i want the video to stop initially. If i don't use this sequence, i don't see anything. Can you give me a snippet to preload the video? I tried getting oNetStrem.bytesLoaded but it only returns a value IF i called "play" method hence the pause call. So will i do the preload code after the above code?

              • 4. Re: FLV
                Harry Kunz Level 4

                What's FMS?

                • 5. Re: FLV
                  Petro O. Bochan Level 3

                  Flash Media Server

                  1 person found this helpful
                  • 6. Re: FLV
                    Harry Kunz Level 4

                    Thanks Petro. Is there any way how i can get the total time of the NetStream? I'm using a scroll bar to traverse the loaded FLV clip but i'm not sure what the most efficient way is to do that. My plan was to use ratio and proportion of the scroll length and scroll position to the total time length then get the appropriate time and use NetStream.seek() to position the clip depending on the scroll position but i don't know how to get the total time length of the clip. Or could i get the total frames of the loaded flv file instead and use a gotoAndPlay? How to gotoAndPlay?

                    • 7. Re: FLV
                      kglad Adobe Community Professional & MVP

                      use the onmetadata handler to access the flv's duration.

                      • 8. Re: FLV
                        kglad Adobe Community Professional & MVP

                        you can't load an flv using anything.

                        • 9. Re: FLV
                          Harry Kunz Level 4

                          kglad, i'm using NetStream.seek(nTimePosition) in an onEnterFrame function while dragging a knob but the output is not smoothly traversing.

                           

                          var nTime:Number = nPositionPercentage * oNsInfo.duration;

                          nTime = Math.round(nTime * 10)/10;

                          oNetStream.seek(nTime);

                           

                          Does seek method take too much time and thus slows down on a repetitive call during dragging? What other methods can i use to traverse smoothly with a knob?

                          • 10. Re: FLV
                            kglad Adobe Community Professional & MVP

                            you shouldn't apply the seek() method more than 2 or 3 times per second.  use setInterval().

                             

                            i find 2 times per second leads to excellent results.

                            • 11. Re: FLV
                              Harry Kunz Level 4

                              Updating 2 times a second is too slow......:-( Is there no other way to make it faster? Maybe not use seek? No other methods/hacks available? How about a goto frame function?

                              • 12. Re: FLV
                                Harry Kunz Level 4

                                Or can i load the external flv file in such a way that it can be treated like an SWF?

                                • 13. Re: FLV
                                  kglad Adobe Community Professional & MVP

                                  it doesn't look too slow to me or any clients i've done this for.

                                   

                                  but if that doesn't work for you, try more frequent updates.

                                  • 14. Re: FLV
                                    Harry Kunz Level 4

                                    Thanks kglad for your inputs. By the way i just realized that it is fast. At first i thought it was slow but then i realized that only the frames with "cue points" in the flv are "seekable" when fast traversing the flv with a slider knob.

                                    • 15. Re: FLV
                                      kglad Adobe Community Professional & MVP

                                      you're welcome.