Playing sounds on clicking within image – upgrading to html5?
-
My posts sometimes feature images where clicking in different places plays different sounds, e.g. the symbols in the first picture here:
https://englishspeechservices.com/blog/cardinal-vowels-ear-training-and-quiz/
Apparently they don’t play on iPads etc. Can anyone please help me to upgrade my method, which I cobbled together some time ago and is shown below? If anyone can help, please be as explicit as possible about where I put various bits of code, whether in posts or in .php files etc. (I have tried to follow various methods online and can’t get them to work.) Many many thanks.I have this at the top of my posts
<script language="javascript" type="text/javascript"> function playSound(soundfile) { document.getElementById("dummy").innerHTML= "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />"; }</script><span id="dummy"></span>
Then I put this at the relevant place in the post:
<img src="https://website_path/image.jpg" width="350" height="312" usemap="#my_image" /> <map name="my_image"> <area shape="rect" coords="20,65,50,95" onclick="playSound('https://website_path/sound.mp3');" /></map>
- The topic ‘Playing sounds on clicking within image – upgrading to html5?’ is closed to new replies.