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.
Sounds.
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
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?
To give you an example, how does this gamedo it?
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
And what do you think on the iPhone?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.