debbieau1
asked on
Play sound on DIV click
I want to play audio, when a <div> is clicked.
I will have multiple .mp3s. I need to ensure if one is clicked, then others will not play, or repeat.
It needs to run on an ipad
I will have multiple .mp3s. I need to ensure if one is clicked, then others will not play, or repeat.
It needs to run on an ipad
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Unfortunately several of these solutions do not work on the ipad. I had tried most previously. The desktop isn't hard, particularly if using a flash solution, but the ipad has real latency issues and I am having problems when using multiple audio, that it will sometimes replay previous audio.
If you have any sample scripts using several audios that do work on the ipad without repeating, it would be great to get.
If you have any sample scripts using several audios that do work on the ipad without repeating, it would be great to get.
ASKER
Thanks very much for your perseverance. I have managed to get audio playing on the ipad. I think I may have an answer for the latency, but the biggest issue is still with having several audio files, that it gives unpredictable results.
Sometimes I click on one audio, then another, but a previous one plays, instead of the one just clicked.
I was trying to find a sample that I can test on the ipad, that plays several audios. I need to make sure if I click one that it only plays that one.
Sometimes I click on one audio, then another, but a previous one plays, instead of the one just clicked.
I was trying to find a sample that I can test on the ipad, that plays several audios. I need to make sure if I click one that it only plays that one.
check this example, on how to play and pause using javascript
http://www.position-absolute.com/articles/introduction-to-the-html5-audio-tag-javascript-manipulation/
http://stackoverflow.com/questions/1933969/sound-effects-in-javascript-html5
http://www.position-absolute.com/articles/introduction-to-the-html5-audio-tag-javascript-manipulation/
http://stackoverflow.com/questions/1933969/sound-effects-in-javascript-html5
can u use some server side lanaguage also
with that you can set the play the one and when other is clicked, the one should be stopped
with that you can set the play the one and when other is clicked, the one should be stopped
ASKER
I'm using php, but this really needs to be handled client side. Thanks anyway
did you checked the HTML5 audio tag on ipad?
ASKER
Yep did that. Have run audio successfully on the ipad, it's just when using multiple audio it has been a problem.
did you used the play and pause apis of audio tag?
If yes, please share that code snippet
If yes, please share that code snippet
ASKER
I'm going to have play more with that player when I get a chance
Thanks.
Thanks.
<script language="javascript" type="text/javascript">
function playSound(soundfile) {
document.getElementById("p
}
</script>
<div id="playsound" onclick="playSound('abc.mp
you can always refer you path within the innerhtml tag
I gave a border to Div just to check if this really works as expected or not!
i have placed my abc.mpe in same folder