Skip navigation
Currently Being Moderated

FLV component stops playing video and reverses back to the play button

Jan 24, 2012 2:19 PM

Hope there is a fix for it.

So I have a video which plays in FLV component. It loads, it starts to play and then it stops on its own and a user has to click the play button again.

 

 

Here is my code:

////////////////////////////////////////////////////////////////////// ////////////////////

HowTo_maininfo_mc.JTVs_mc.JTV_SubHeart_btn.addEventListener(MouseEvent .CLICK, JTV_SubHeart_btn_amimated_btnDown);

 

var sourceVar:String;

function JTV_SubHeart_btn_amimated_btnDown(event:MouseEvent):void {

sourceVar="howto_popups/jtvs18w07.mp4";

gotoAndPlay("flv_pb");

}

 

////////////////////////////////////////////////////////////////////// ////////////////////

 

and then in "flv_pb" I have this:

////////////////////////////////////////////////////////////////////// ////////////////////

stop();

 

 

 

close_btn.addEventListener(MouseEvent.CLICK, onClick_GoBackToHowTo2);

 

 

function onClick_GoBackToHowTo2(event:MouseEvent) :void {

          gotoAndPlay("howto");

 

}

 

 

SWF_flv2.addEventListener(Event.REMOVED_FROM_STAGE,stopF2);

 

function stopF2(e:Event):void{

SWF_flv2.stop();

}

 

 

SWF_flv2.source=sourceVar;

 
Replies
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 24, 2012 2:33 PM   in reply to nikolaig

    does the same thing happen when testing locally?

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 8:33 AM   in reply to nikolaig

    if your network download rate is less than 1,200.19 kbit/s you're going to see stuttering video play unless you preload that video.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 9:26 AM   in reply to nikolaig

    repeatedly pressing the play button is not usually required.  there must be something specific in your set-up requiring that.

     

    yes, you can preload a video by starting it and immediately stopping it.  you can then use the progressevent to check your flv's download progress and start it playing when it's downloaded. 

     

    internet video should have a bitrate<384kbits/s.  256kbits/s is typical.

     

    p.s.  please mark helpful/correct responses, if there are any.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 10:14 AM   in reply to nikolaig

    to preload your video:

     

     

    import fl.video.VideoProgressEvent;

     

    stop();

    SWF_flv2.addEventListener(VideoProgressEvent.PROGRESS,progressF);

     

    SWF_flv2source = sourceVar;

    SWF_flv2.play();

    SWF_flv2.stop();

     

    function progressF(e:VideoProgressEvent):void{
    if(e.bytesLoaded == e.bytesTotal){

    trace(e.bytesLoaded,e.bytesTotal);

    SWF_flv2.play();
    }    
    }

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 11:45 AM   in reply to nikolaig

    what's the url to this app and what needs to be done to see the problem, if it's not obvious?

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 12:18 PM   in reply to nikolaig

    the video is the only place on your site where i DON'T see a problem.  your swf performs like a non-optimized app on an iphone/ipad.  i can't remember ever seeing a web-based app perform that poorly.

     

    but back to your video issue.  you're using a skin that shows the download progress of the mp4 and the play progress of the mp4.  do you see the download progress advancing ahead of play progress or does the play progress "catch" the download progress?

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 25, 2012 2:17 PM   in reply to nikolaig

    i strongly encourage your decision to use tweenlite instead of timeline tweening.  the benefits are signficant including but not limited to much better performance and tweens that are much easier to create, edit, tweak and maintain.  that's probably all you need to do to change the performance of that website from poor to excellent.

     

    your description of issues one and two are normal and expected.  when you see the green bars, flash is starting to download the mp4 and buffer the video.  when you see play progress catch download progress, you expect the video to stop.  if you wait until flash has buffered enough video (download progress advances ahead of play progress), the video should start by itself.  if you force it to continue play when not enough has buffered you should expect the video to stop as soon as play progress catches download progress.

     

    so, everything you've describe is expected.  to remedy either download the video before starting play (described above), get a better internet connection (i see no problem with your video playback becaues my connection is faster than your connection) and/or decrease the bitrate of your video.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 26, 2012 8:37 AM   in reply to nikolaig

    you're welcome.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 31, 2012 10:08 PM   in reply to nikolaig

    no and no.

     

    are you having a problem a problem because more than 1 video is downloading at the same time?  if yes, use the closeVideoPlayer() method which will require you to juggle video player indices.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 1, 2012 2:23 PM   in reply to nikolaig

    no, that doesn't stop the video from downloading.  it stops the video from playing.  it will continue to buffer unless you use the closeVideoPlayer() method.

     

    you should google how to use it because there are several steps that i don't recall that you need to take.  something like:

     

    SWF_flv2.addEventListener(Event.REMOVED_FROM_STAGE,stopF2);

     

    function stopF2(e:Event):void{

    SWF_flv2.activeVideoPlayerIndex=1;

    SWF_flv2.closeVideoPlayerIndex(1);  // only execute this if the video has not completed download.  ie, use the progressevent

    SWF_flv2.stop();

    }

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 2, 2012 7:27 AM   in reply to nikolaig

    i've used closeVideoPlayerIndex() successfully before (to stop downloading unneeded streams).  so, it does work.

     

    and that other thread looks the same as the code i suggested above except i added a visibleVideoPlayIndex, too:

     

    ok, i just tested and it works.  but, you have to assign the player index before assigning the source:

     

     

    SWF_flv2.addEventListener(Event.REMOVED_FROM_STAGE,stopF2);

     

    function stopF2(e:Event):void{

    SWF_flv2.stop();

    SWF_flv2.closeVideoPlayerIndex(1);  // actually, you can execute this after the stream completes, too so there's no need to check.

    }

     

    SWF_flv2.activeVideoPlayerIndex=1;

    SWF_flv2.visibleVideoPlayerIndex=1;

    SWF_flv2.source=sourceVar;

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 2, 2012 9:43 AM   in reply to nikolaig

    my typo.  that should be:

     

    SWF_flv2.addEventListener(Event.REMOVED_FROM_STAGE,stopF2);

     

    function stopF2(e:Event):void{

    SWF_flv2.stop();

    SWF_flv2.closeVideoPlayer(1);  // actually, you can execute this after the stream completes, too so there's no need to check.

    }

     

    SWF_flv2.activeVideoPlayerIndex=1;

    SWF_flv2.visibleVideoPlayerIndex=1;

    SWF_flv2.source=sourceVar;

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 2, 2012 12:12 PM   in reply to nikolaig

    the play()/stop() code is used to start buffering your sourceVar.  if you don't want/need to buffer, don't.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points