View Full Version : Sound coding works only until loaded

Nov 21st, 2010, 06:40 AM
I created a webpage, and I wanted to add the sound of underwater bubbles. After many hours researching the coding and converting a wave file to an ogg file, I was able to make it work on my computer, but when I uploaded to the FTP server, there was no sound. I used this code for the sound:

<object classid="Water bubbling.ogg" codetype="audio/ogg Standby="" Title="Darca's Birthday">
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6:Water bubbling.class" codetype="audio/wav" width=2 height=0 standby="" Title="Darca's Birthday">
<OBJECT DATA="Water bubbling.ogg" type="audio/ogg" title="Darca's Birthday" width=2 height=0>
<param name="autostart" value="true" >
<param name="src" value=Water bubbling.ogg" >
<param name="autoplay" value="true >
<param name="hidden" value="true">
<embed src="Water bubbling.ogg" hidden="true" loop="true" autoplay="true" autostart="true" type="audio/x-wav" />
<noembed>audio sounds</noembed>

Here's the link for page -- I really want this to work -- it would be so cool.

Do I need more code? Is this something that maybe my webhosting provider needs to fix?

Thanks for your help.

Nov 21st, 2010, 10:01 AM
I haven't actually done any audio stuff before but i have a few ideas. For starters you said it's an ogg file? I have no idea what that is, does it need to be an ogg? But given you've used this file is codetype=audio/wav right? Have you double checked that's what's needed and its not trying to find a .wav. Also chrome asks me to install a quicktime plug-in where as IE does not. Could be IE doesn't support what you're trying to do, and i'm guessing most browsers need a plugin. Maybe because you already have quicktime it works client side but not from the server or something? I dunno, maybe that will help in finding your answer. But on a side note you need to do something about your fishies. Do they have fixed positioning on them or something? They move with the rest of the page and get all glitchy.

I say or something a lot...

Nov 21st, 2010, 11:30 AM
Here's some revised code that uses the HTML5 audio element with an HTML object element as fallback. The code works for me in Mozilla Firefox 4.0 Beta 7, Google Chrome 9.0 (Dev Channel), and Opera 10.6. (The version of Firefox I'm using seems to have some bugs; when using the object element only, the music inexplicably stops playing after a few seconds and the fallback content of the element is improperly displayed even though the audio content is successfully loaded.)

The code doesn't work in Windows Internet Explorer 9 Platform Preview 6 (or is it 7?) or Safari 5. I'm not certain exactly what they support in terms of the object element, but it seems that WIE9 supports MP3/AAC and Safari supports whatever QuickTime supports (e.g., MP4) for the audio element. (Both Apple and Microsoft have a financial stake in the formats they're pushing which explains both that and the fact that they don't support the free format (Ogg Vorbis).)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<audio controls="controls" loop="loop" autoplay="autoplay" src="Epoq-Lepidoptera.ogg">
<object type="audio/ogg" data="Epoq-Lepidoptera.ogg">
<p>Your Web browser does not support playback of Ogg Vorbis audio files. You can <a href="Epoq-Lepidoptera.ogg">download this audio file</a> instead.</p>

The audio file used can be located at http://www.vorbis.com/music/. It's just a random free file.

Dec 23rd, 2010, 12:19 PM
Thanks so much for your reply. I didn't see it before. I think I'm going to just try the wav file. I tried the link, but I couldn't open the ogx file. I will definitely your advice in my memory banks! Thanks so much.