Jump to content
Search Community

Alternative to play() method

Fryck test
Moderator Tag

Recommended Posts

Hi all,

 

i'll try to explain my request (i sucks in english, be tolerant :P)

 

Actually i have an flash application witch sync Audio and Timeline.

i use NetStream.Buffer.Full event to know when i must start the Timeline

Where the difference of timeline currentTime and stream.time is higher than (for example) 200ms, I resynchronize stream and timeline.

 

I would avoid this method, so I tried to use the event so that each frame ENTER_FRAME I advance the timeline, like this:

timeline.currentTime = stream.time but rendering is not smooth (flash is set framerate to 50 fps) how it is it?

 

Should I use a loop rather than rendering TimelineLite ... ?

 

Thanks for read me.

Link to comment
Share on other sites

that sounds like a pretty clever approach.

 

synchronizing sound and animation is know to be "virtually impossible" in flash unless the sound is embedded in the swf and set to "stream".

 

chances are your stream is advancing in great intervals between ENTER_FRAME events so the TImelineLite is jumping ahead to catch up.

 

Maybe use a Timer with very low interval like 50ms?

 

would be interested to hear if this works

Link to comment
Share on other sites

I tried, FPS drop dramatically... :)

 

Althought, At this point, i have good results (you can check it out here http://www.karafun.com).

 

I would really avoid this "synchronization" with this tolerance constant (200ms between the stream and the timeline) I find it not very clean.

 

Perhaps the best thing I make myself a render loop ​​to try to be as accurate as possible?

 

But is there a "low level" method to render timeline at time T, like TimelineMax.render(time: Number).

 

Because I feel that changing the value currentTime slowed considerably.

 

Thanks.

 

It's really frustrating for me not to speak English correctly ... ;)

Link to comment
Share on other sites

very cool results. I appreciate the magnitude of what you accomplished.

 

Perhaps someone else will be able to answer you question about the low level render method, my gut thinks currentTime is probably the closest you will get.

Link to comment
Share on other sites

Yeah, setting currentTime is your best bet. Technically there is a renderTime() low-level method but it doesn't reposition the playhead, so it's more of a one-off for rendering and is undocumented for a reason :)

 

The cost of calling currentTime is VERY minimal. I can't imagine how it could cause any noticeable slowdown whatsoever. Typically with Flash, literally 98%+ of the CPU load is related to graphics rendering or audio, NOT ActionScript execution.

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.
×
×
  • Create New...