Jump to content
GreenSock

Philip Bulley

Bug: VideoLoader playback gap

Recommended Posts

I'm only using the word bug here as something that works with LoaderCore.version: 1.83 no longer works the same way with LoaderCore.version: 1.87.

 

I have two H.264 video files, the end of the 1st cuts seamlessly to the beginning of the 2nd.

 

When the first video dispatches VIDEO_COMPLETE, I do the following:

 

removeChild( video1.content );
addChild( video2.content );
video2.gotoVideoTime( 0, true );

 

After swapping versions of greensock.swc, I noticed that 1.87 will display a couple of frames of black whereas the older 1.83 will seamlessly swap between the two videos, so 1.83 works well. If there is any extra info I can give you, please don't hesitate to ask.

Link to comment
Share on other sites

Short answer: set the new autoDetachNetStream special property to false.

 

Longer answer: more recent versions of VideoLoader automatically detach the NetStream from the Video object when it isn't in the display list in order to improve (reduce) memory usage. Apparently the video pixels aren't fully decoded into memory until the NetStream is attached, so it's usually best to only attach it when you need it (when you're actually wanting to display it). Imagine loading 20 videos in the background (maybe only displaying one) - the old version of LoaderMax attached the NetStreams to their Video object right away which led to unnecessarily high memory usage. The only down side to waiting to attach the NetStream is that Flash sometimes takes a little time (like a frame, maybe 2) to actually render the video. That explains the flashing effect you saw. If you set autoDetachNetStream to false, VideoLoader will act like it did in older versions. If you're not loading many videos, that's perfectly acceptable.

 

Let me know if that works well for you.

Link to comment
Share on other sites

Relieved to see this is something intentional and not a random bug! Apologies for wielding the "BUG" headline!! I have a lot of faith in the greensock toolkit :D

 

So, I'm now setting autoDetachNetStream on all of my VideoLoader objects, but now it looks like some netStreams are not attached to Video, whereas some are successfully attached (it almost alternates sequentially as I go through videos). I suspect this, as on some videos I see black whilst I can hear the audio.

 

Got to leave work now, but I'll do some more in depth testing tomorrow. If you have any pointers or things you'd like me to test, feel free to let me know :) Cheers!

Link to comment
Share on other sites

Hmmm...some just aren't being attached at all? Never seen that before - can you post an example FLA (with support files) that demonstrates the issue? You set autoDetachNetStream:false on all of them, right? And you're using the latest version of LoaderMax? We're up to 1.881 now :)

Link to comment
Share on other sites

I've put together a test FLA. Basically it seems that the erratic behaviour happens when "videoLoader.autoDetachNetStream = false". If you comment out that line, it seems that all netstreams are attached as expected (but with the gap as explained earlier, so not a viable solution). I'll PM you the link to download the test package. Thanks!

Link to comment
Share on other sites

hi,

 

this is exactly the same behavior, I described before:

viewtopic.php?f=6&t=5958

 

I tried to use the most recent version without success. thanks for investigating...

Link to comment
Share on other sites

Ah, very interesting. Thank you VERY much for the sample files. They made it much easier to identify and isolate. There are so many bugs, inconsistencies, and baffling behaviors of Adobe's NetStream class that it's quite challenging to chase them all down especially because behavior can change based on the way your video was encoded and the Flash Player version you're targeting. Anyway, I was able to see the issue you mentioned and I worked around it in the latest version of VideoLoader. Please give it a try and let me know if you can break it (I tested it several times in your file and it worked great). Snag the latest and greatest at

Link to comment
Share on other sites

Looks good to me. I'll keep an eye on this and let you know if it ever breaks again.

Thanks for your, as ever, ultra fast response and fix!

Link to comment
Share on other sites

So the fix works nicely in the test FLAs I sent you, but doesn't in my main project even when "videoLoader.autoDetachNetStream = false" :(

 

I'm still getting a couple of frames of black before the video starts playback. After tinkering with VideoLoader, I've found that removing the "if (_video.stage != null)" from VideoLoader._applyPendingPause solves my problem. Kind of. I no longer get the gap, but it would seem that I cannot later dispose(true) of the loader.

 

VideoLoader._dump is getting called with a scrubLevel of 3, but the memory never gets released. The flash player will eventually crash with an "out of memory" trace as I later load more VideoLoaders. I can confirm that when the if statement inside VideoLoader._applyPendingPause is present, the memory is released successfully.

 

Does this help? Anything else you'd like me to try?

Link to comment
Share on other sites

Could you post a sample FLA that demonstrates this behavior?

Link to comment
Share on other sites

I've PM'd you a new test.

It's not an FLA, but an extremely distilled version of how I use the VideoLoaders in my project.

I notice the gap about 90% of the time in this example (flash of bright green background).

 

You can re-compile the VideoStandaloneTest.as via MXMLC (I'm using FDT with Flex SDK 4.5.1 targeting FP10.2), but please test the SWF in bin first, just to see if you also get the flicker. Thanks!

Link to comment
Share on other sites

  • 3 weeks later...

Sorry for the delay - I believe this is fixed in the latest version. Please download and give it a shot at your earliest convenience.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×