There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Playing MP3 files in Javascript


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
malcolmd3111's Avatar
Member with 53 posts.
 
Join Date: Aug 2005
Experience: Intermediate
22-Dec-2005, 10:30 AM #1
Question Playing MP3 files in Javascript
I would like the simplest method possible for playing an MP3 audio file in Javascript. No rollovers, no start buttons etc. I've looked at various suggested ways and none of them work.

This works in html:

<EMBED height="96" src="Audio/wwintro00.mp2" autostart=true hidden=true width="128">

How to do this in Javascript? Thanks for any suggestions.

Malcolmd3111
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
22-Dec-2005, 02:55 PM #2
Any JavaScript is just going to create HTML code similar to that anyway, is there a particular reason you need to use JS?
malcolmd3111's Avatar
Member with 53 posts.
 
Join Date: Aug 2005
Experience: Intermediate
22-Dec-2005, 08:10 PM #3
Yes! I have an existing JS script which creates a series of 36 timed images building a sequence of the Wisdom Wheel. see

"thewisdomwheel.com/indexpdf.html"

It's hard to synchronize a large mp3 file to all the "stones" being placed. It's easy to create 36 short audio clips and play them when the various stone images are laid down so to speak.

Hope this helps,

Malcolmd3111
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
22-Dec-2005, 08:21 PM #4
You can have a javascript change the src of the <embed> tag when the image is changed. but any way you do this is going to have timing problems, as it will take quite a while for the mp3s to download.
cristobal03's Avatar
Distinguished Member with 2,991 posts.
 
Join Date: Aug 2005
Experience: Advanced
22-Dec-2005, 10:13 PM #5
The thing about javascript is that it was designed to "manipulate" a document's objects on the client side. What you're trying to do involves client-server interface; I think you'll probably need a more robust combination than javascript/HTML to get the functionality you're after. You could possibly do it by switching the embed, as Brendan suggests, if you preload the mp3s. But I wouldn't bank on that.

chris.
malcolmd3111's Avatar
Member with 53 posts.
 
Join Date: Aug 2005
Experience: Intermediate
23-Dec-2005, 09:07 AM #6
Chris,

you're correct. Javascript client side isn't the way to go. It's becoming too messy. I'll need to look at another method. Thanks for the comments. BTW, I have a script running, but I cannot synchronize the image placement with the audio clips. The audio clip plays immediately, not delayed as required.

malcolm
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:56 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.