jeudi 16 avril 2015

Android HTML5 video in WebView

I am attempting to play an HTML5 video within my WebView app. It works as expected on every device I have tested that is running Android 5.x, but does not work on any device running 4.x, meaning it essentially doesn't work at all.


I have turned on hardware acceleration and I have set a WebChromeClient as the docs say to do, but the video still will not play.



In order to support inline HTML5 video in your application, you need to have hardware acceleration turned on, and set a WebChromeClient.



AndroidManifest.xml



<application>
android:hardwareAccelerated="true"
...
</application>


MyFragment.java



webView = new WebView(getActivity(), null, this);
webView.setWebChromeClient(new WebChromeClient());


Is there something else I need to do that is not documented in the developer reference?


Aucun commentaire:

Enregistrer un commentaire