Share Posted August 29, 2013 Hi, i realise this is way too similar to this thread: http://forums.greensock.com/topic/4683-mp3loader-making-a-perfect-loop/ but since this is about a video, not an audio (and therefore, I don't have the "repeat" property), I thought I'd ask. My idea is to loop a video that I've loaded using VideoLoader, but I want it to be a seamless loop. My first (and obvious) approach was adding a listener for the VIDEO_COMPLETE event on the video, and then play the video again from 0: var video:VideoLoader= LoaderMax.getLoader([videoId]) as VideoLoader; video.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete); protected function onVideoComplete(event:LoaderEvent):void { var video:VideoLoader= event.target as VideoLoader; video.gotoVideoTime(0); video.playVideo(); } but this doesn't make it seamless, it freezes on the last frame of the video for a second or two, and then starts again. My second approach was adding a listener for the PLAY_PROGRESS event, and when the video reaches a certain sufficient point, start it from 0: var video:VideoLoader= LoaderMax.getLoader([videoId]) as VideoLoader; video.addEventListener(VideoLoader.PLAY_PROGRESS, onVideoComplete); protected function onVideoComplete(event:LoaderEvent):void { var video:VideoLoader= event.target as VideoLoader; if(video.playProgress >= 0.95){ video.gotoVideoTime(0); video.playVideo(); } } this made it better, but the same problem stays, it freezes (now not on the last frame, but on one of the last ones) and then starts all over. Is there a way to have a smooth loop, or another approach to make it smoother than these two I've tried? Thanks! Link to comment Share on other sites More sharing options...
Share Posted August 30, 2013 Tough to say without seeing it. Chances are this has to do with how Flash handles video, or perhaps the encoding of your vide, and less about something VideoLoader can enhance. Have you tried looping without VideoLoader. Any better? Link to comment Share on other sites More sharing options...
Share Posted April 29, 2014 I'm interested in how to obtain a good looping experience with a FLV. Sofar it does not work as expected. The weird thing is that my loop (which is 1024x688) loops perfect once or twice, then it starts gettting jumpy. I tried adding a cue point at the end and the start. I also tried using constant bitrate over variable.. havent suceeeded yet. I even thought about recording the loop as bitmap frames, and replay the loop from those. Probably the best solution, the only issue is that, it would require a good size of RAM (the SWF and FLV framerates runs independantly =/ ) Link to comment Share on other sites More sharing options...
Share Posted April 29, 2014 Another thing.. when testing the video "repeat" option, it seems to work better locally than when it's being played back online =/ ( not sure if this is correct =P ) Online test: http://edweb.dk/Temp/videoloop/greensockvideoloop.html Source files: http://edweb.dk/Temp/videoloop/GreensockVideoLoop.fla http://edweb.dk/Temp/videoloop/videoloop.flv Actually when testing the files locally, it loops pretty good =/ why can't it do the same when online? Edit: from looking at the online videoloop, it's seems that it does not rewind fully.. Any comments on this would be apreciated Edit2: Changed the test video, (burnt-in progressbar + framecount) Link to comment Share on other sites More sharing options...
Share Posted April 29, 2014 Hmm, i'm not sure, but i seem to get better results if i leave on a empty soundtrack in the FLV ( normally i'd disable it entirely ) Without sound track http://edweb.dk/Temp/videoloop/greensockvideoloop.html <-- this runs fine for a couple times, then it starts to jump: With empty sound track http://edweb.dk/Temp/videoloop/greensockvideoloop2.html Link to comment Share on other sites More sharing options...
Share Posted April 29, 2014 Thanks for the 2 examples. This further solidifies that this is more of a native Flash issue than anything amiss in VideoLoader. All VideoLoader does (for the most part) is tap into native methods and events of NetStream and Video objects. As a test I would suggest removing VideoLoader from the mix and see if you get better results. A quick search shows some alternatives: http://stackoverflow.com/questions/10193937/how-to-loop-flv-seamlessly which of course change every time adobe releases a new version of the Flash player. Perhaps you can try restarting the video just a smidgen before it gets to the last frame as mentioned in that article Link to comment Share on other sites More sharing options...
Share Posted April 29, 2014 Hey Carl, apreciate your thoughts on this For now i've "solved" this by leaving a empty sound track in the FLV's it may not be 100% seamless, but it's acceptable in my situation. 1 Link to comment Share on other sites More sharing options...
Share Posted May 5, 2014 A little update: I tried using f4v instead, same thing =/ Update2: So far i'm getting best results by looping between two cuepoints (having some "spare" video before the looping point, aprox 1 sec). I think the fact that the video file has to go all the way back to 0, has some negative effects in regards to looping. Edit: I dont' know if it makes any diiference, but i set the looping cue to have the type "Navigation", and the replay cuepoint is set to "Event". Link to comment Share on other sites More sharing options...
Share Posted May 5, 2014 Ok, it's definitely possible to get a perfect loop with flv's. i',m actually unsure of that now What WONT work is, if your flv is exactly the length of the loop. blablablalaI guess the best thing is to do the looping with cuepoints. Not sure if the looping cuepoint has to be the type of "Navigation" , but i somehow imagine that the encoder adds a keyframe exactly at that frame (i might be totally wrong about that) f4v's works fine with this method..Note: if youre developing AIR for IOS, then f4v is a "no-go" (legit info ), it wont play the file, so stick with flv's (only tried flv and f4v) Link to comment Share on other sites More sharing options...
Share Posted May 5, 2014 Thanks a bunch for posting this info. I'm sure it will help others. Link to comment Share on other sites More sharing options...
Share Posted May 6, 2014 Yiikes!!!... sadly, i was wrong, when i upload to the internet it goes wrong..,damn, I thought i tested it online (the whole purpose of my recoding :/)I'm having deadline tomorrow on a crossplatform app web/desktop/IOS (all in one code, yeah ;D ) - and i NEED animated backgrounds made from video...So since the FLV plays and loops fine locally (IOS/Air), and only giving problems when used in web app (standard flash), i'm going to use FFMPEG to convert the FLV's i already made, into SWF's (wooot) That might sound like a lot of extra work, but infact it's done superfast, and lossless! as FFMPEG can simply wrap the existing FLV into a SWF, no re-encoding! So only a little extra work there, and then , ok, i need to make the code able to handle both types of background animation.. but that's pretty easy, and done once I made a bat file that i can drag drop a FLV file onto and it will convert it to SWF, it looks like this "%~dp0ffmpeg" -i "%~1" -vcodec copy -f avm2 "%~dpn1.swf" (Bat in same folder as ffmpeg.exe) So for now, i'm back to using FLV's that has the exact length of the loop (for use as local content), AND then convert those FLV's to SWF's for web use. This is quite a workaround.. i and i must admit i'm a bit disapointed in flash when comes to videolooping, which i thought flash would be king at. Edit: ffmpeg creates a video object on stage with the instance name "video", so you can use rawContent.video.smoothing = true , after the SWF has loaded. -- Some info and more workarounds (from the guy Tony) http://stackoverflow.com/questions/10193937/how-to-loop-flv-seamlessly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now