![]() |
alert as a time delay
This is a bit odd. The sound will play and then go to the video (which is what I want) but only if I include the alert!
Code:
soundManager.play('scratch','../../media/mp3/scratch.mp3');How can I get rid of the alert and have the sound play then go to the video? Something about giving the sound enough time to play? |
Quote:
|
It's weird Philip.
Code:
soundManager.play('scratch','../../media/mp3/scratch.mp3'); |
Try a longer timeout period.
Note than an alert() suspends program execution but setTimeout() does not - it just delays the execution of the function. Look into your code with that in mind. |
I'm not familiar with soundManager (I'm guessing it's a plug-in), but many audio players have event listeners built in. You could investigate the soundManager documentation, see if it has an "onuadioended" (or similar) event, and when that fires, call a function to run your video
[EDIT]: If this is the same one you're using, the onfinish event at this link may prove useful: http://www.schillmania.com/projects/soundmanager2/doc/ |
Note that document.writeln is as dead as Netscape 4 (the last browser that needed it) and since then alert has been repurposed as a debugging tool - so neither statement should appear in a live script.
|
Thank you xelawho.
It turned out to be 'onfinish' which worked. I have learnt to read the screed for the plugins, but I must confess, I would not have been likely to find that solution - even having read up on it. |
felgall, is there an alternative to document.writeln (besides document.write)?
How else could you make the video play? |
Why so you need to use JS to create that <object>...</object> code? Why can't you just drop it in the HTML without using JS at all?
|
Quote:
Alternatively you could use the proper DOM commands such as createElement and insertChild to create and add HTML tags from JavaScript. Of course the simplest way where the tags are not being changed after the page loads is to simply hard code them in the HTML. write and writeln can only output to the page before it finishes loading so anything those commands can do can be done using HTML without JavaScript unless the values to be output are being generated (in which case a server side language would be more appropriate). |
OP, I have to use the document.write method because an inline frame is being called and depending on a cookie (giving the disk drive letter), the video being played is either streamed across the web or played from a disk.
However, I will investigate felgall's advice and see if I can get that working as an alternative. Not sure how that would work though... I've made a demo at: http://aapress.com.au/demo/diskorstream/page1.html |
| All times are GMT +1. The time now is 03:04 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.