Jump to content


Tween.fromTo of VideoLoader Instance in TimelineMax

Moderator Tag

Recommended Posts

I am trying to set the beginning and ending time with of the video for use in the TimelineMax TL with the GASP v12 version. CS5 Player 10 (10.3 for use with Director)


I put it here because I don't think it makes any difference which version is used.


I had played and got the video (a month ago when I last worked on this) to play using frames but the audio was choppy. I believe it was keyframe sync issues. And now my files are external too.


Here's a couple of variations of the single line of code that I tried.


TL.append(TweenMax.fromTo(vids[mcV], (vids[mcV].duration()), {playProgress:0}, {playProgress:1} ));

(gets: TypeError: Error #1006: value is not a function.)


TL.append(TweenMax.fromTo(vids[mcV], (vids[mcV].duration()), {time:0}, {time:vids[mcV].duration()}));


Don't remember if I need to the VideoLoader.content route or I am just missing it.


I will be loading a Text Display MC's, Video, MC, Video, etc. The TL linked to a scrubber will give my template users a chance to add captions - (30 plus languages using strings). The timeswill be displayed by the scrubber. Now Audio, Video and Captions can all be syncronized and handled in one way using TimelineMax.


At least this is my plan.




Link to comment
Share on other sites



place the following traces right before your append:


trace( "vids[mcV] is a " + vids[mcV] )
trace( "duration = " + vids[mcV].duration() );
trace( "playProgress = " + vids[mcV].playProgress );


what does that report?


I'm guessing that duration should be a property and not a method



but I don't know what type of object vids[mcV] is.

Link to comment
Share on other sites

Thanks Carl.

I have my video queue completing out of the expected order. Fix it in one spot then it breaks in another.


vids[mcV] is a VideoLoader '[object VidTest5]' (Video/captions.flv)


Back to the tracing the flow. I am going to have to fix the sequence first.

Link to comment
Share on other sites

Carl is correct - VideoLoader has a "duration" property - it's not a method. But there's a bigger issue here - I don't think it's wise to tween the playProgress of a VideoLoader because of the nature of NetStreams in Flash (and video in general). Video is a very unique beast in terms of playback because it uses keyframes and partial frame data inbetween them to keep file size down and speed processing. So when you jump to a new position in a NetStream (video), Flash must analyze the data, find the closest keyframe, and start playing from there. If you're doing that on every frame (which is what tweening does), that is likely going to result in playback that isn't very smooth.


Think of it like an old record player where you drop the needle down and it starts playing as it moves along the groove. You need to let the needle go for it to work smoothly. But imagine if you forcefully tried to drag the needle on the record (even if you tried to do it in a relatively smooth fashion) - it isn't how a record player is supposed to work and you'll end up with strange sounds or a scratched record.


Flash can take a few milliseconds (or occasionally more) to rebuffer the NetStream each time you change the position of the virutal playhead, so if your swf has a frame rate of 60fps that means Flash would need to rebuffer and find the closest keyframe 60 times per second. And unless you put a keyframe on EVERY frame when you encoded your video, it would be impossible to play the video perfectly smoothly in that scenario.


See what I mean?


And to be clear, none of this has anything to do with VideoLoader or LoaderMax - it's just how compressed video and NetStreams work in general.

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.