• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Audio Base64 in a Webview not loading

RewindJAA

Newbie
I have a html page (on the desktop and/or the server) which loads base64 audio in the Chrome browser perfectly fine.

However, when I put this html page as an asset in an Android App which appears in a webview in the app, it just will not load the sound.

When I run the app, bypassing the check of whether the sound is loaded the app works fine, but without any sound. This even includes base64 graphics which all load fine.

I have done the following in my android code:

webSettings.setJavaScriptEnabled(true);
webSettings.setAllowContentAccess(true);
webSettings.setDomStorageEnabled(true);​

I have also set:

android:hardwareAccelerated="true"
into activity tag in manifest.

The relevant bits of html code:

var sound = new Audio();
sound.src = "data:video/ogg;base64,T2dnUwACAAAAA.....etc";​

And the check:

var soundLoaded = sound.readyState=== 4 ? true : false;​

Note: sound.readyState stays on 0.

Also note, the sound.src is perfectly set, everything sees fine.

The sound is an ogg file, but I guess I could do a mp3 if I really have to.

Have I missed something?
 
Last edited:
Back
Top Bottom