Sounds.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Sounds.

Post by JellyFish »

Hey, I was wondering how I could play an mp3 file without flash, but with javascript and html?

How can I play a audio file with javascript? How can I use HTML's embed or object element to play a audio file and allow javascript to play the file again and again.

I've tried appending a new embed element into the body element via javascript, but it's not as responsive as I'd like it to be; it's slow; the audio file doesn't play right away.

Hopefully I'm asking the right question; the question that I really am asking.

Thanks for reading. I'd so much appreciate any help with this.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Have to searched for "embed audio file in web page" or similar? There are many, many pages that explain how to use the <object> and <embed> tags to play audio that loops.
(#10850)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mmm... reminds me of the early to mid-nineties midi files blasting poop.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

mp3? plugin needed for sure. If you use the "embed/object" method it will load a huge player, which majorly sucks. I've implemented a simple flash player for a band website, worked very nicely indeed.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

First, I don't want a looping audio file. I would like to be able to make a sound not with HTML only, but with javascript, only if possible; I don't think I can make a sound with only javascript, but I probably can do it with both HTML and javascript.

To give you an example, how does this gamedo it?
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

Do I make sense?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

The code of that page shows them creating an <embed/> tag for sound playback. I have a strong feeling that an embed tag uses the default media player on the system for that particular mime type. On Windows that's probably Windows Media Player, on Mac it's almost definitely Quicktime.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

Kieran Huggins wrote:The code of that page shows them creating an <embed/> tag for sound playback. I have a strong feeling that an embed tag uses the default media player on the system for that particular mime type. On Windows that's probably Windows Media Player, on Mac it's almost definitely Quicktime.
And what do you think on the iPhone?
Post Reply