Embed wav files in IE and firefox

-Cryptic-

Weaksauce
Joined
Jan 28, 2006
Messages
66
How do I get audio files to play to not be blocked by IE. When my index loads up it, I have to allow all blocked content.On the other hand firefox doesnt even recognize the embed html it just shows a white box. Do i need to use another language or just re work the code?
 
May I inquire the reason for wanting to embed a wave file into the page to begin with?
 
If you want to embed wav files, there are a few ways to do it.

If the browser ( like Opera ) supports HTML5's Audio object:

Code:
<script type="application/javascript">
    if (window.Audio && window.addEventListener) {
        var song = new Audio("file.wav");
        if (song) {
            song.addEventListener("load", function(s) {
                if (s && s.target && s.target.play) {
                    s.target.play();
                }
            }, false );
        }
    }
</script>

The embed element, which usually works across the board:
(Try this first)
Code:
<embed type="audio/x-wav" src="file.wav" autoplay="true" autostart="true" width="300" height="50">

Note that the browser will embed the wav file with whatever plugin is associated with audio/x-wav. This is usually the Quicktime plugin and most often, you need to have it installed for this to work. Quicktime uses the autplay param. For other handlers assume 'autostart'. Do note that the server should send the file as audio/x-wav or if it's local, have a .wav extension.

Same thing, but with HTML4's object element used the way it was intended. ( Usually won't work in IE.)
Code:
<object type="audio/x-wav" data="file.wav" width="300" height="50">
    <param name="autoplay" value="true">
    <param name="autostart" value="true">
</object>

Use the object element improperly for IE so it specifically uses the ActiveX quicktime plugin and other browsers fallback on the all around embed element:
Code:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="300" height="50">
    <param name="src" value="file.wav">
    <param name="autoplay" value="true">
    <embed type="audio/x-wav" src="file.wav" autoplay="true" autostart="true" width="300" height="50">
</object>

(There are variations on this style.)

Again, you usually need the quicktime plugin or some other plugin like the vlc plugin that comes with videolan.

There's also the bgsound element that might work in some browsers like IE.

Anyway, If you're loading the page locally in IE, you may get the activeX warning, but when you put the page on a server, you won't get that warning.

Also, for others, if the file is embedded on the page unexpectedly, set it to not start playing automatically to be nice to your visitors. However, if it's on a page where the user expects it to autoplay when they visit, set it to start automatically.
 
Tawnos said:
May I inquire the reason for wanting to embed a wave file into the page to begin with?
well, since we are all on "broadband" we may as well waste a couple of MB for a wave file, ignoring that in most cases an mp3 would go the same job with much less required storage space.

Then again, I despise most websites with built-in audio.
 
I meant mp3s my bad i dont y i was thinkin wav files. So then on the code would all the wav file extension be .mp3
 
-Cryptic- said:
I meant mp3s my bad i dont y i was thinkin wav files. So then on the code would all the wav file extension be .mp3

Same suggestions, only type="audio/mpeg" and the .mp3 extension. ( and minus the Audio object as that's just for .wav files so far.)
 
K now if i want to use streaming media support how would i go about that.
I've dled windows media encoder 9 and im messin with it but i dont know how to encode the audio files for the site.

basically wat im trying to do is that when people go to my site they can hear my beats i made but not be able to capture them or dl them. (in other words steal them)

how would i go about this so i can have my mp3 files or wat ever on there but save from people stealing them.
 
-Cryptic- said:
K now if i want to use streaming media support how would i go about that.
I've dled windows media encoder 9 and im messin with it but i dont know how to encode the audio files for the site.

basically wat im trying to do is that when people go to my site they can hear my beats i made but not be able to capture them or dl them. (in other words steal them)

how would i go about this so i can have my mp3 files or wat ever on there but save from people stealing them.

You'd have to serve them with a streaming server like shoutcast, or the Windows Media Server that comes with IIS. Haven't really messed with it though, so not sure what you need exactly.

However, even if they're streamed, someone can just use a stream ripper to build a file from the stream, which would be almost as bad. There's always flat out recording from the input also.

So, basically, don't offer high quality downloads or only offer clips if you don't want someone stealing the whole work.

You could of course just offer your beats and state that no one else can use them etc., but that doesn't stop anybody.

Doing the streaming will make it more difficult, but not impossible. How far do you want to go? Are you going to sell full-length, full-quality copies of your beats?
 
Easiest way would be to use windows media encoder. Just convert the file to a Web Server Progessive dowload. Save and you have a wma file that'll quasi-stream. It's not true streaming per say. But if you wanted to stream you'd have to have an asx file and set mime types on your server. Just stick with web server progressive download to save the headache.
 
Yes I want to sell full copies of the beats. I got the beats tagged so the actual file they would steal has my production company name playin in the background.

Will making it a progessive download make it harder to steal or is there another way or program to stream the audio so that it is pretty much as safe as it can be so people can jsut download the file straight from the website.

And if i did do the progressive download how would i get it to play in the site. Would i use embeded tags still. Cuz im using go daddy and i dont know if they have windows media support so......
 
K so i tried the quick time one and i keep getting plug in errors.
It says plug in found, but an error in the plugin has occured.
Also i want to code the .m3u file i created into these players to make it more secure how would i go about that?
 
Back
Top