Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript clock image & sound out of sync 3

Status
Not open for further replies.

rogerp54

MIS
Joined
Feb 22, 2006
Messages
1
Location
GB
Question from a complete novice(me)working with someone using javascript to design a 'clock' that has an image and a sound effect for that image. The 'clock' shows milliseconds to years. The problem is the sound goes out of sync with the corresponding image (especially with the millisecond images). After a short time (10-15 secs) they get in sync with oneanother again then go out of sync..and so on.
Does anyone know a solution to keeping these images and sounds in sync with oneanother?
Any help/pointers would be really appreciated.
 
You might possibly achieve perfect synchronicity using Flash. I doubt whether you will ever achieve this cross-browser using just JavaScript, however

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Well... not really. You could look at doing the whole thing inside Flash -- where you will get better control over timings... but there are too many varying factors when considering javascript within a browser.

For instance... a slow computer will struggle to handle a browser, image swapping within Javascript and triggering a sound (the sound is managed by the operating system and requests will be deferred until it can process them) all at the same time.

You might settle for a fixed loop sound effect that has a steady tick... regardless of the image rotation speed.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Suggestions to try making things a bit more in synch.
Pre-load the images so they take a lot less time to swap.

Can you pre-load the sound as well? So you have it as an object on the page to use rather than referencing it on the server each time it has to occur.

Can you execute the sound as a result of the changing of the image so that they always follow each other?



Stamp out, eliminate and abolish redundancy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top