• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

seamlessly looping FLVPlayback video no longer seamlessly looping

Explorer ,
Oct 03, 2012 Oct 03, 2012

Copy link to clipboard

Copied

Hi,

 

Back in 2009 I created seamless video loops using the FLVPlayback component and 'addEventListener' (as3)—and they worked great!  looping round and round seamlessly—equally well in browsers as in flash. The videos were of varying lengths, small (all between 50—500K), and they looped perfectly.

Recently I've gone back to update things and noticed that my video loops are no longer seamlessly looping in any of the web browsers. Now there's a big pause interrupting the seamless flow.

 

  ??? why?  Has something in the delivery (browsers/flashplayer) changed?  All my video loops still run seamlessly when tested in Flash (CS5).  I spent a good amount of time investigating various angles but could not find any solution.

 

  Anyhow, here's the actionscript:

 

  stop();

 

  import fl.video.*;

 

  toggleButton.addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);

  toggleButton.addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);

  toggleButton.addEventListener(MouseEvent.CLICK, toggleClick);

 

  toggleButton.buttonState = "off";

      function rolloverToggle(event:MouseEvent):void {

      toggleButton.gotoAndStop(toggleButton.buttonState+" over");

      }

      function rolloutToggle(event:MouseEvent) {

      toggleButton.gotoAndStop(toggleButton.buttonState);

      }

      function toggleClick(event:MouseEvent):void {

          if (toggleButton.buttonState == "on") {

              toggleButton.buttonState = "off";

         vid_16_monty.pause();

          }else {

              toggleButton.buttonState = "on";

         vid_16_monty.play();

      vid_16_monty.addEventListener(VideoEvent.COMPLETE, rewind);

      function rewind(event:VideoEvent) {

         vid_16_monty.play();

          }

                }

          toggleButton.gotoAndStop(toggleButton.buttonState+" over");

      }

 

 

the video that goes with the above script can be viewed here:  http://www.designfail.us     cat should be in seamless motion... but it's not.

Also, not sure it would make much difference, but I'd be happy to attach an fla file—Adobe says it's a good idea but nowhere do they tell you how to attach an fla file... very peculiar, especially in these emphatic UI/UX times we live in.

Views

26.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2012 Oct 03, 2012

Copy link to clipboard

Copied

Not sure at all what flash player you ever saw an external FLV loop seamlessly on but it's been my vast overwhelming experience that it just cannot do that. Never has.

The only way I ever got FLVs to loop seamlessly was placing them on the timeline. Otherwise there was always a studder when the playhead hit the end and seek(0)'d (same as just throwing it a new play() which is what your rewind() is doing).

Depending on what you're doing you could try alternatives like StageVideo. It may handle the loop a bit better although I doubt it.

Also, that delay is pretty big. Even back in the AS2 FLVPlayback days the delay was nowhere near what I'm seeing. You might want to consider adding in a AS cuepoint while trying to seek(0). I've never had that much loop delay.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 03, 2012 Oct 03, 2012

Copy link to clipboard

Copied

thanks for the reply Sinious,

I've encountered the opinion that it's just not possible (except timeline). But it is. Or perhaps I should say was. And hopefully still is...

There's plenty of sites/forums where the FLVPlayback/addEventListener method is detailed in creating seamless flv loops.  In my recent traipse through the interwebs though, they all seem to be dated around 2007-2010...

I do know it's possible (or at least was) because I and other people have seen it work. Tested on all major browsers, PC/mac, and all the vids played back seamlessly.  Otherwise I would not have published it: http://www.octopistudio.com/OS_Web01_4ourX5ive.html

It looks like crap now, but you can imagine it playing back seamlessly...

I do agree with you that the delay is big.  Even more so for something that used to run seamlessly... with AS3. 

I am seriously baffled why something that used to work no longer does.  It seems like Flash should be getting better, not worse.

I've read about the cuepoints, but from what I've read they don't seem to create a  seamless loop.  It needs to be seamless.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2012 Oct 04, 2012

Copy link to clipboard

Copied

Code does take execution time.

Make sure buffers are on your side. If the buffer is constantly cycling through buffering with a prebuffer delay, playing and finally flushing, that could cause your playback issue. That would cause the pause I'm seeing. Simply trace your netstreams onstatus events to see if the messages line up with the delay.

On any modern CPU a seek should be instant and a cuepoint has almost zero overhead as well. Keep in mind cuepoints need to coincide with a keyframe. You can't seek to anything but a keyframe without a FMS. Your desire shouldn't make this an obstacle as obviously you desire to seek to frame 1 which is always a keyframe. However your cuepoint can fire off just short of the end of the video, never causing a COMPLETE event or buffer flush. That may be of some help.

Seamless FLV looping is not a hard issue to find.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 04, 2012 Oct 04, 2012

Copy link to clipboard

Copied

Seamless FLV looping is not a hard issue to find.

true.  Second listing:

"We noticed this on the transition from Flash 10 to to Flash 11.  Flash 10 loops seamlessly, but Flash 11 has a ~1 second stall when calling seek(0) from NetStream.Play.Stop."

which is exactly what I'm talking about.

So why do Adobe customers need to scramble to fix their code whenever a new version of Flash Player is released?

And why do 'experts' like yourself, who are very active on this forum, state that "but it's been my vast overwhelming experience that it [Flash Player] just cannot do that (loop FLV seamlessly)".   Statements like that make finding a solution, or a bug, more difficult than need be.

Anyhow, I do appreciate your response.  It's just frustrating as an Adobe user to have put a lot of time and effort into something that worked perfectly, only to be told (forced) to go back to redo it.  Like the kid who comes and kicks down your lego tower, then runs away.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2012 Oct 04, 2012

Copy link to clipboard

Copied

My first suggestion was checking status events to locate the precise point it studders to investigate a solution.

The second was another means of smoothing out the delay with a pre-fire playhead change invoked via a programatically added cuepoint near the duration of the clip.

Why do "developers" like yourself who come to the forum for suggestions while both ignoring suggestions and berating other members attempts to help? Statements like that make it more difficult than it should be to assist you.

If you continue to be an Adobe user, this won't be the last bug you'll need a workaround for, more will come. They call it work, or workaround, for a reason. Adobe had no intention of video looping being a bane of anyones existence.

If you knew it was a known issue and can't find any solution to it, why did you come here just to complain about Flash Player? At least do it in the right forum.

http://forums.adobe.com/community/flashplayer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 04, 2012 Oct 04, 2012

Copy link to clipboard

Copied

sinious, it was through the link on your previous posting that I discovered that it was a Flash Player issue. 

Second listing on search thread:  http://stackoverflow.com/questions/10193937/how-to-loop-flv-seamlessly 

Please see my post above.

As for the other claims:

1. I'm not a developer.

2. I am truly appreciative and thankful for your help. Please see my above two posts.

3. Video looping is not the "bane of [my] existence."  But it sure would be nice if it were easier.  Or—as it stands—it would be nice to not not have that functionality removed with the advent of a new Flash Player.

I don't know why it's so difficult to see that that would be frustrating... 

My frustration was certainly not meant personally.  Unless you are Adobe or perhaps authored the new FlashPlayer?  I don't know...

The only critique I made to you was concerning the statement that seamless flv loops are impossible. They're not.  In my researching this issue I saw a lot of that reflex on the web—that seamless flv loops are impossible. It was more my intention to debunk that myth than to create animosity.  I'm sorry I didn't phrase that better.  Please accept my apologies.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 05, 2012 Oct 05, 2012

Copy link to clipboard

Copied

No harm done. Wish I could have helped. A workaround at this point seems like your only alternative even if it is quite a bit of work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 11, 2012 Oct 11, 2012

Copy link to clipboard

Copied

per your advice and because it makes sense I've posted a thread in the Flash Player forum -

http://forums.adobe.com/thread/1080707

I've looked into workarounds but barring a complete re-write of code (like you say... "quite a bit of work") I have not found any solutions.  Some questions did occur though:

1. Is there anyway to implement AS3 netstream code to communicate with the FLVplayback component?  For example in the stackoverflow link above, addressing the buffer seems to help, and since the FLVplayback component is a netstream object can it be modified as such?

2. Is there any way to modify the flvplayback.as file to make this work?

Any advice would be greatly appreciated, thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 11, 2012 Oct 11, 2012

Copy link to clipboard

Copied

There's certainly nothing magical about FLVPlayback. Why not implement your own video player with Video / NetConnection / NetStream?

You're more than welcome to extend the FLVPlayback class. Just do this:

package

{

    import fl.video.FLVPlayback;

    public class FLVPlaybackExtended extends FLVPlayback

    {

        public function FLVPlaybackExtended()

        {

            super();

        }

          // override what you like down here or add more code and properties

    }

}

FLVPlayback does not extend NetStream however, it extends the Sprite class and provides an easy wrapper around the VideoPlayer class. You'd have to be familiar with the insides to really get anything efficient done here.

If you read the VideoPlayer documentation then you can see it has a property that gives you read-only access to both its NetStream and NetConnection.

If you want to control the NetStream object you're better off just implementing it yourself. By the way, have you considered OSMF? It's built into Flash. Look at the org.osmf.* API (here's media).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

so how would how would the the actionscript 3 look for this seamlessly looping with Video / NetConnection / NetStream ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

The NetStream class linked above has lots of examples of playing a video using the underlying classes. It's extremely easy. The jist is, make a null NetConnection, attach the NetStream. Give the NetStream something to stream via a URLRequest. Attach a Video object to that stream, add the Video object to the stage and you shall see video.

All the events you're used to having are pretty much there although some (like adding dynamic cuepoints) I believe are only for the FLVPlayback, you'll have to check. Generic events like the NetStream coming to a COMPLETE event will be there so you'd be hooking your loop up to that just the same.

These classes are all for display. You'll have to invent your own controls and wire them into the NetStream class to pause/play/seek/etc. For your needs I don't think you need anything more than play/pause so that's why I suggested just making your own player.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

I agree it's easy—so have you tryed it?  easy enough to snag my video and give it a whirl...

What I get using Netstream (with NET_STATUS and "NetStream.Buffer.Empty" or "NetStream.Play.Stop") is an improvement from the current regressive one second lag of the FLVplayback method, but it's certainly not the seamless loop I used to get using FLVplayback in Flash Player 10.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

That's the bog I've been seeing since the beginning of time. I feel it's just a buffer flush and fill that takes a second. And yes I've built countless video players for a variety of reasons. Usually because my play controls were always custom so I had no real need for anything FLVPlayback could do.

Play around with the buffer size. Do things like set the buffer size to the entire size of the video so it won't even start playing until the buffer is full and try to avoid a buffer empty. I'm not sure it's even possible but it's why I recommended using something like a cuepoint very close to the end of the video to hit and loop to avoid NetStream.Play.Stop altogether.

Perhaps try uninstalling your Flash Player and install an older version (like 10) and see how it does. I think since FP8 (the last time I tried looping) you'll see the same bog you're getting right now:

http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html

Lastly I haven't tried it myself but perhaps you should take a shot with StageVideo. The hardware decoding might be fast enough to handle the loop seamlessly and it's how all video will evolve anyhow.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageVideo.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

that cat video that I've been using is all of 69 KB...  another one of my looping videos is 30KB...  I took great care to whittle them down so that they would load fast... play smoothly.  Buffer time should be mere fractions of a second if that.  But they all lag, regardless of size.

Its confounding, frustrating, and frankly regressive. As mentioned, when using Flash Player 10 with FLVplayback (with addEventListener VideoEvent.COMPLETE) they all looped seamlessly.   Speaking of loops, this loops right back to the beginning of this thread...

Yes I could keep trying new ways... but I've already put a lot of time (time that I really don't have) into something that worked perfectly well.

I find it strange that Adobe remains silent about this.  I was hoping that by posting at the source, in the Adobe forum, that they may chime in.  Certainly they must be reading this.  But that hasn't happened, neither here nor in my Flash Player posting.

Going backwards on a functionality that is both valuable and popular makes no sense to me...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

What type of play/looping response do you get from this short looping example?

http://www.cidigitalmedia.com/tutorials/loop_vid/loop_vid.html

This video uses

ns.onStatus = function(info)....

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

adninja, looks alright but hard to tell since your vid isn't of circular construction—the return from end to beginning is an abrupt one and therefore hard to gauge. 

When my cat vid is running seamlessly there is—visually—no beginning or end, just one smooth continuous motion.

As for actionscript, it looks like we're using the same Netstream method as I mentioned above ("NetStream.Buffer.Empty" or "NetStream.Play.Stop") except you're using actionscript 2 I believe?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 16, 2012 Oct 16, 2012

Copy link to clipboard

Copied

Yeah what I was getting at was do you see a lag at the end of the video when it loops back. From what I understand is that lagging before loop back was your problem. So I'm assuming that what you want is a hard cut back to the beginning... no lag. That's what I was curious about.

Looking at the cat video I don't think that what you are seeing as a lag has anything at all to do with the player. Rather, the video has a couple of frames at the very end that are exactly the same... making it look like the video is lagging before returning to the beginning of the time line.

You can quickly test this theory by opening the video in an editing program or at least test in Flash by embedding in the main timeline and then scrub the timeline. The last couple frames are exactly the same and show no movement (making it look like the video has stopped). Also the last frame and the first frame to not match exactly, which you would need for a seemless loop. Notice the position of the cats eyes in relation to the tail in the first frame and then compare that to the position of the eyes in the last frame. Also notice the amount of red under the head in the first frame compared to the last. The head is not in the same position... so there is a slight jump as the vid loops back to the beginning.

In my test I deleted the duplicate frames and eliminated the apparent lag at the end of the vid.. but of course could not do anything about the cats head positions not matching when it loops back to the beginning.

Also testing your vid in Flash player 10 and 11 showed exact same results... an apparent lag before looping back to the beginning... which was really not a lag at all, just duplicate frames at the end of the video.

Now I don't know if this was the only video that you are having problems with but it's my opinion that in the case of this particular video, the player was not at fault, rather it was the video itself.

Best wishes,

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2012 Oct 16, 2012

Copy link to clipboard

Copied

@ adninja - not sure if you've read the whole thread or not, but I can assure you it is not the video (or any of the 20 videos).  Have you taken my cat video and actually examined it? in a video editor or even played it within Flash?  If you have, you will find your above points to be mute.

I will repeat it once again here:  All 20 videos looped absolutely seamlessly using the method detailed in my initial post above. Tested on all major browsers, PC/mac, all the vids played back seamlessly.  Otherwise I would not have published it. The year was 2009.

I appreciate your attempts Adninja, but the video(s) is not the problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 16, 2012 Oct 16, 2012

Copy link to clipboard

Copied

Well my observation on the cat video is just as I stated above, plays back the same in Flash player 10 and 11.

Then downloaded the video file itself and examined in video editor first... that's where it seemed to have duplicate frames at the end. The opened Flash and embeded the video file directly into the timeline... sure enough, there were duplicate frames at the very end.... which made it look like the jump from last to first frame was lagging when actually it was just playing the duplicate frame. Eliminated that extra frame and it looped just fine.

Very simple and easy to test for yourself, just embed the vid file into the timeline and scrubb... last couple frames are duplicates. Did you test that?

Now of course that has nothing to do with other files but that's what I see wrong with the cat file. Would be interested in looking at another video/ example of lag if possible.

Best wishes,

Adninjastrtor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2012 Oct 16, 2012

Copy link to clipboard

Copied

@ adninja - I've never had a problem with the cat video (flv).  As mentioned it plays smooth as butter in Flash, or for that matter in Windows Media Player with repeat (loop) turned on.  It just doesn't play well in Flash Player anymore given the above stated parameters.

Speaking of which, you never mention what your actionscript looks like, so it's hard to know what exactly you're testing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2012 Oct 17, 2012

Copy link to clipboard

Copied

I can confirm there's no duplicated frames in montysM's cat video. I tried the StageVideo approach and unfortunately being it still uses the NetConnection and NetStream classes, the looping lag still exists. I tried a few different codecs and codec settings, all acted identical. Actually it also blinks unless you pause() and resume() the object instead of just seek()ing. So that's not a solution either.

OSMF deserves a try.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 18, 2012 Oct 18, 2012

Copy link to clipboard

Copied

Testing your cat vid link in IE, FF, and Safari, the vid plays pretty well, except for the duplicate frame at the end. Those browsers had various older versions of Flash pluggin installed. Using Chrome, with a 11.4.31..... version of the Flash player, there is a very pronounced lag at the end of the video before looping back to the beginning.

Testing this link in that same browser/player:

www.cidigitalmedia.com/tutorials/loop_vid/loop_vid.html

shows a hard loop from the end of video back to a few seconds into the video... seek set to 20.

This is the AS2 used:

/* Video player created by CI Digital Media for educational purposes */
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
video_screen.attachVideo(ns);
/* Name of your video, with correct path, goes here */
ns.play("loop_vid.flv");

ns.onStatus = function(info) {
  if(info.code == "NetStream.Play.Stop") {
  trace("Video complete")
    ns.seek(20);
  }
}
//-------Sound Controls--------//
this.createEmptyMovieClip("sound_mc",this.getNextHighestDepth());
sound_mc.attachAudio(ns);

var videoSound:Sound = new Sound(sound_mc);

mute_btn.onRelease = function() {
if (videoSound.getVolume() > 0) {
  videoSound.setVolume(0);     
  }
  else
  {
   videoSound.setVolume(100);
  }
}

So it does look like there is a real problem with the latest version of Flash player browser pluggin and the AS3 code you are using. You might want to try the older AS2 version and see what effect that has.

Best wishes,

Adninjastrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2012 Oct 18, 2012

Copy link to clipboard

Copied

AVM1 (AS2) and AVM2 (AS3) are totally different engines. You can't expect anything between them to work identically (thankfully), AVM2 and AS3 are far superior in uncountable ways. I would highly recommend staying the course in AS3, finding a bug report of this looping playback issue and posting that link here. I'll happily vote it up. The more votes it gets the faster it will get fixed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 18, 2012 Oct 18, 2012

Copy link to clipboard

Copied

sinious -

Thanks for looking into this and giving the StageVideo a shot. I've never filled out a bug report, but I'll look into it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines