Playing audio from http link in webview. But webview crashes in HTML5 version of app?


I am currently using a webview to play mp3 audio files loaded from a server. This works well in testing on my mac, but not when I export a HTML5 version of the app. It seems to me that in the HTML5 version of the app, webview doesn’t work at all? The webview isn’t even visible and the app crashes whenever a webview is being attempted to be opened. Is this a known issue?

Is there a way around this? Another way to play mp3 files located on a server?

This is the code html I’m loading into the webview, using webview.open_raw(webview_id, audioplayerhtmlcode)

>     <html><body><center>
>     <audio src="audiofilelink" autoplay>
>     Your browser does not support the <code>audio</code> element.
>     </audio>
>     </center></body></html>

Yes, the webview only works for iOS, macOS and Android. We could expand support to Windows and Linux as well, but a Webview in HTML5 is a bit weird isn’t it? The whole game is running in a “webview” (the browser). We could probably build something that behaves like a webview on HTML5, but I think it’s better if you use the existing webpage and add the <audio> tag to it.

You can for instance use to add the audio tag. Or you could modify index.html and add the audio tag, but disable autoplay, and instead manually start playing it using

1 Like

OK thank you, I’ve got something working now in HTML5.

It would be nice if webview would work in windows and linux as well. The more the better I say. The same solution would work on more platforms.

I agree. But it’s not a common request so the priority is low. The repo is open source so anyone could add the support of needed.

1 Like