El audio no funciona en la vista web de Android
Frecuentes
Visto 1,741 equipos
1
I open a website URL
en Android WebView
inside an application. One of the web pages contains links to Images and Audio files on server. Server in response reads the file requested and writes the content to Response
stream and sets appropriate Content-Type
. The images is opening perfectly but audio is not playing, it just flashes a window with the URL
and just goes away immediately. I am using Java Script window.open()
para este propósito.
When I access the website directly in Android browser, its playing the sound by opening native music player application. I am wondering why the same is not working inside WebView
.
Do anybody have idea about such kind of problem? If you have further query on the same, I will provide. Please share your experience.
¡Gracias!
1 Respuestas
0
This is a bug inside the webview. you can use video tag replaced to audio tag as an example:
<video width="320" height="240" controls>
<source src="audio.mp3" type="video/mp4">
</video>
Respondido el 12 de junio de 17 a las 03:06
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android audio webview or haz tu propia pregunta.
Can you be specific. What version of Android? What phone are you testing on? What browser are you using that it works on? - Pieces
Thanks Pieces! I am using Samsung Galaxy Y with Android 2.3.6. I think when we are using
WebView
its the default functionality of Android and for direct testing of website, I used default browser, which upon hitting the sound link gives option to play with native music player apps. - RamKrAny hint on how do I debug the problem? Is it
Java Script -> window.open()
that could be the culprit? Why different phone behaves differently for AndroidWebView
.Java Script
is already enabled as an image is opening successfully using same procedure. Its working on Intex XOLO (ICS) phone while not working on Samsung Galaxia (2.3.6). Gracias. - RamKrJust to let you know that the problem is solved automatically and I am closing this question as it was working on the next day, may be the issue could be due to
Wi-Fi
connection accessing the local network server. When it was not working it was flashing the window appeared to open theURL
and disappeared immediately without going further at the point of opening Media Player to play the requested audio file. Cheers! - RamKr