View Full Version : Coding Query
^KoalaBear^
09-09-2002, 04:28 AM
Is there any way of coding an html page to prevent a sound file, say an .mp3 or .wav, starting to play before it has fully downloaded to the visitor's computer?
It gets annoying to people with slow dialup (56k) connections, to hear stop-start-jumping sound on a site, before it fully loads.
Cheers!
KB...
webmarkart
09-09-2002, 04:52 AM
I'll tell you whats more annoying, having to wait for the music to load just to see the page! I personally don't reccommend having music and if its a must I would suggest importing it into flash so the size is compressed (at least a little).
joh6nn
09-09-2002, 05:01 AM
uh, in theory, the whole thing has to download before it can play, unless you're doing streaming content, which isn't something you "just do" . so to the best of my knowledge, you shouldn't be experiencing this problem.
if you are, can we see the code you're using?
^KoalaBear^
09-09-2002, 05:03 AM
I'm afraid I have to agree with you!
The sites I'm building are not commercial sites, but 'feel good' pages for lady friends. LOL... They ALL want midis and wavs on them... Small media files are generally ok, but larger ones do or can, frustrate the visitor.
As far as Flash and Shockwave goes, I'm afraid they are for my 'next' life. As fantastic as they are, learning them ain't easy for an old nerd like me... and my shrink wants me to avoid all unnecessary stresses, anyway!! LMAO
Cheers!
KB
Quiet Storm
09-09-2002, 05:04 AM
I, too, would suggest Flash.
If you really need to, I've found that placing the sound code at the very bottom of a page seems to work.
</BODY>
<EMBED SRC="waltzma.mid"></EMBED>
</HTML>
hairynugs6382
09-09-2002, 05:23 AM
Well while everyone is on the subject of flash. Could someone direct me to a place to learn about how to create flash animation?
Quiet Storm
09-09-2002, 05:27 AM
For beginners, download and install SWiSH:
http://www.swishzone.com/index.php
webmarkart
09-09-2002, 07:01 AM
Flashkit.com is by far the best flash tutorial site I have found. http://flashmove.com/board/ is also a Flash message board to post any specific questions.
^KoalaBear^
09-09-2002, 04:56 PM
Originally posted by joh6nn
uh, in theory, the whole thing has to download before it can play, unless you're doing streaming content, which isn't something you "just do" . so to the best of my knowledge, you shouldn't be experiencing this problem.
if you are, can we see the code you're using?
Here are the 2 test sites where I've embedded a wav into the pages..
1. http://homepages.ihug.com.au/~dww8/sound/sound-script-aa.html
2. http://homepages.ihug.com.au/~dww8/sound/sound-script-bb.html
The 2 codes used are:
1... hidden
</body>
<p><embed src="misty.wav"
HIDDEN=TRUE HIDDEN=AUTOSTART loop="true">
<bgsound src="misty.wav" HIDDEN=TRUE HIDDEN=AUTOSTART loop="true">
</html>
2... visible
<center>
<p><noembed><BGSOUND SRC="misty.wav"></noembed><embed SRC="misty.wav" AUTOSTART=TRUE
height=46 width=145 LOOP="true"></embed></center>
Both play ok in IE6 but as I suggested, stop and start while the files are downloading.
Cheers!
KB..
^KoalaBear^
09-09-2002, 05:16 PM
Originally posted by Quiet Storm
I, too, would suggest Flash.
If you really need to, I've found that placing the sound code at the very bottom of a page seems to work.
</BODY>
<EMBED SRC="waltzma.mid"></EMBED>
</HTML>
Thanks Quiet..
Here is the test site I used your suggested code..
http://homepages.ihug.com.au/~dww8/sound/sound-script-cc.html
Unfortunately while it loads ok, it still wants to play in stops and starts... at least to a 56k dialup visitor. I agree about where to place the code and always put it right at the bottom of the pages if I can.
Cheers!
KB...
realisis
09-09-2002, 05:30 PM
Yikes! KoalaBear no wonder... You're using actual .wav files for playback, almost 2.4 meg in size!
Though I noticed you limited the file to 8-bit mon at 11kH, you can mitigate the download time even further by going with any of the various lossy-compression schemes available. Common ones are MP3, Real Audio (or Real Media), Windows Media.
You could potentially knock off about 90% of the file-size this way.
Sorry I haven't any real specifics to give you though. Although I've some experience doing high-end audio, I haven't done any audio for web, so the mechanics of compressing the files are a bit beyond my current experience.
...
Regarding autostart only after pageload, IE may have some property which can be reset via JS after all elements have loaded. I'll check into it, and post again if I find anything.
Cheers -
Quiet Storm
09-09-2002, 05:33 PM
You do realize that "misty.wav" is 3-minutes 40-seconds long?
For .wav file that's huge!
That's 2.32MB in size... that's bigger than my entire site! :eek:
^KoalaBear^
09-09-2002, 07:24 PM
Originally posted by realisis
Yikes! KoalaBear no wonder... You're using actual .wav files for playback, almost 2.4 meg in size!
...
Regarding autostart only after pageload, IE may have some property which can be reset via JS after all elements have loaded. I'll check into it, and post again if I find anything.
Cheers -
LOL thanks realisis...
Yes it is large, but I did convert it back in quality from a much larger size as you noticed. I can compress it even futher as a .wav or as an .mp3 file. but its not the size that is causing the troubles. Even a 500kb sound file takes time to load fully but will still start trying to play before finished. I'm not sure what you are referring to as 'Windows Media' coz the code I used opens my Win Med Player to play the sounds on IE6.
"Regarding autostart only after pageload"... I think thats what I may be looking for somehow. I'll happily wait to see if you can find something for me. I'm hoping if you can, that it doesnt stop the whole page loading until the sound file does, though.
Thanks and Cheers!
KB...
^KoalaBear^
09-09-2002, 07:28 PM
Originally posted by Quiet Storm
That's 2.32MB in size... that's bigger than my entire site! :eek:
ROFL... Yep, you'll see by my reply to realisis what I did, but true, I would normally only embed very small .mid files or a smaller .wav file when creating pages! The example I used only helped highlight the pre-load playing problem more! LOL...
Sorry if I shocked ya.
Cheers
KB...
fivesidecube
09-09-2002, 07:52 PM
^KoalaBear^,<EMBED SRC="waltzma.mid"></EMBED>This may be totally off the mark, but can you name the EMBED tag and remove its src value. Then create a function that is called from the body's onLoad event that sets the embed's src element.
The reason I'm not sure about this is that I can't remember if the EMBED element is accessable via the DOM!
Quiet Storm
09-09-2002, 08:15 PM
<BODY onLoad="javascript:document.write('<EMBED SRC=waltzma.mid></EMBED>');">
Maybe?
^KoalaBear^
09-09-2002, 08:56 PM
Originally posted by fivesidecube
^KoalaBear^,This may be totally off the mark, but can you name the EMBED tag and remove its src value. Then create a function that is called from the body's onLoad event that sets the embed's src element.
The reason I'm not sure about this is that I can't remember if the EMBED element is accessable via the DOM!
LOL Thanks too, fivesidecube
If I was that techi, I'd be laffin.... but alas, I'm not. I'm just a very old nerd who gets a bit of fun creating easy chit and tryin hard to get through each day.
Cheers!
^KoalaBear^
09-09-2002, 08:59 PM
Originally posted by Quiet Storm
<BODY onLoad="javascript:document.write('<EMBED SRC=waltzma.mid></EMBED>');">
Maybe?
Hmmm... Now even at 5.30 in the morning here, that looks cool. LOL. As soon as I get some shuteye I'll try it and let ya know how it went, Mate! Thanks alot
Cheers!
KB...
^KoalaBear^
09-10-2002, 06:29 AM
Here's the current page I was working on with a very small wav (213kbs).....
Remembering September 11, 2001
http://home.graffiti.net/kbs_great_aussie_sites/911/index.html
Please be patient while page loads
KB...
fivesidecube
09-10-2002, 09:12 AM
^KoalaBear^,<BODY onLoad="javascript:document.write('<EMBED SRC=waltzma.mid></EMBED>');"> This isn't exactly what I had in mind. Doesn't writing to the document after loading actually clobber the whole document! I was think more along the lines of:<BODY onLoad="javascript:document.embedsound.src = waltzma.mid">
<EMBED name=embedsound></EMBED>or something like that.
The reason I'm not sure this will work is that I'm not sure that you can give embed tags an id or name and secondly, if those items are presented via the javascript's DOM.
brothercake
09-10-2002, 02:05 PM
That won't solve your problem though - even if you wait until the page has finished loading, and then point to the sound src, the same thing will happen for users on slow connections.
Audio streaming with mp3 or wav is a facet of the plugin - in most cases a large audio file download will attempt to play as soon as it has buffered enough; but networks and bandwidth vary - a modem-user will not be able to stream such a large file without the stop-start behaviour you've heard
Choose something which is suitable for real-time streaming at low bandwidth - RealAudio
joh6nn
09-10-2002, 02:29 PM
i have heard, but i don't know if it's true, that you can preload audio, the same way you preload images. i have never tried it, but i suppose it's worth a shot.
<Script>
var sound = new Image()
sound.src = "http://www.whatever.com/sound.wav";
window.onload = function() {
document.embeds['embedname'].src = sound.src;
}
</Script>
^KoalaBear^
09-11-2002, 04:59 PM
Originally posted by Quiet Storm
<BODY onLoad="javascript:document.write('<EMBED SRC=waltzma.mid></EMBED>');">
Maybe?
Well I couldnt get that suggestion to work, Quiet. Thanks for the thought though. I appreciate and will try any tip I can get.
KB...
^KoalaBear^
09-11-2002, 05:03 PM
This isn't exactly what I had in mind. Doesn't writing to the document after loading actually clobber the whole document! I was think more along the lines of:<BODY onLoad="javascript:document.embedsound.src = waltzma.mid">
<EMBED name=embedsound></EMBED>or something like that.
[/B]
Well I will try this code and see how it comes up. Thanks Matey!
Much appreciated.
KB...
^KoalaBear^
09-11-2002, 05:07 PM
Originally posted by brothercake
Choose something which is suitable for real-time streaming at low bandwidth - RealAudio
Thanks for the tip, bro... As I'm not too familiar with 'real-time streaming', is there any chance you might like to post a simple script for that suggestion, using say, last_post.wav as the sound file?
KB...
^KoalaBear^
09-11-2002, 05:12 PM
Originally posted by joh6nn
i have heard, but i don't know if it's true, that you can preload audio, the same way you preload images. i have never tried it, but i suppose it's worth a shot.
<Script>
var sound = new Image()
sound.src = "http://www.whatever.com/sound.wav";
window.onload = function() {
document.embeds['embedname'].src = sound.src;
}
</Script>
Thanks joh6nn, I shall try that suggestion too, and see how it comes up. Thank you, too, for the thought. Also much appreciated.
KB...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.