Problems with HTML 5 tags (no sound) with telephony on android 4.x

Platform : Android version 4.x

Problem : HTML 5 Tag

Compiled : Phone Saver Framework

I tried to reproduce a simple sound with HTML 5, I can not get it to work.

I read that Android has a common “non-supporting” thing, but as I understand it, version 4.x supports the HTML 5 Audio tag.

Config.xml I have included some functions in it, for example. Access to files, access to devices and so, I even tried to turn on all functions. Just so you guys know.

HTML This is what I am working with atm with, I thought maybe I should go back to try to get the sound and then make the costum controls using JQ.

<audio controls="true">
    <source src="media/sound.mp3" type="audio/mpeg">
    <source src="media/sound.ogg"  type="audio/ogg">
    <source src="media/sound.wav"  type="audio/wav">
    Your browser does not support HTML5 audio.
</audio>  

Conclusion Until I hear any sounds, I tried to call it in various ways, for example:

var Newsound = new Audio("sound.ogg");
Newsound.play();    

Any idea or suggestion is welcome.

Thanks in advance: -)

+5
source share
3 answers

This usually requires a piece of JavaScript. Try the following:

<audio id="a" controls="true">...

var audio = document.getElementById('a');
audio.addEventListener('touchstart', function() { audio.play(); }, false);

When the user touches the sound element, sound should now play.

+1
source

@Ian Devlin

I tried this and I still hear the sound.

New updated exmaple:

HTML header

<script>
  var audio = document.getElementById('myplayer');
  audio.addEventListener('touchstart', function() { audio.play(); }, false);
</script>

HTML body section

<body>
  <audio controls="true" id="myplayer">
    <source src="media/1.mp3" type="audio/mpeg">
    <source src="media/1.ogg"  type="audio/ogg">
    <source src="media/1.wav"  type="audio/wav">
    Your browser does not support HTML5 audio.
  </audio>  
</body>
0
source

​​ Android >= 4.2, Android 2.2 4.0 , Android 4.1, , , :

<audio autoplay loop autobuffer>
    <source src="http://buecrplb01.cienradios.com.ar/Mitre790.mp3" type="audio/mpeg" />
</audio>

Pay attention to the loop attribute: I found several streams that were played within 1 second and stopped, after adding the attr loop they played continuously.

0
source

All Articles