Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/01/2014, 18:24
josemota
 
Fecha de Ingreso: marzo-2010
Mensajes: 35
Antigüedad: 14 años, 2 meses
Puntos: 1
Exclamación Problema con audio

Hola,

Probando jquery mobile, estaba haciendo algo muy simple, puse un header, un contenido con una imagen y un footer, al darle clic en la imagen, suena un sonido. Si lo subo a una web y lo pruebo con el navegador del móvil lo reproduce correctamente, el problema lo tengo cuando genero el .apk a través de phonegap build, que no reproduce el sonido. ¿Alguién sabría decirme el motivo?.

Aquí dejo el código:

Código HTML:
<html>
<head>
 <title>Prueba de sonido</title>
 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=no">
 <script type="text/javascript" src="jquery-2.0.3.js"></script>
 <script type="text/javascript" src="jquery.mobile-1.4.0.js"></script>
 <link rel="stylesheet" type="text/css" href="jquery.mobile-1.4.0.css">
 <style>
  .centrado {text-align:center}
 </style>
 <script>
 $(document).ready(function() {
    var playing = false;
 
    $('#imagen').click(function() {
		
        if (playing == false) {
		    playing = true;
            document.getElementById('player').play();
        } else {
		    playing = false;
			document.getElementById('player').pause();
            document.getElementById('player').currentTime = 0;  
        }
 
    });
});
</script>
 </head>
<body>

 <div data-role="page">
  
  <div data-role="header" data-theme="b" data-position="fixed">
    <h1>Sonido</h1>	
  </div>
   
  <div data-role="content" class="centrado">
    <img src="imagen.jpg" height="60%" id="imagen" width="75%">	
   </div>
  
  <div data-role="footer" data-theme="b">
   <h4>Footer!</h4>
	<audio id="player" src="audio.ogg"> </audio>
  </div>  
 </div>
 
</body>
</html>