html – Android embedded HTML5 video-ThrowExceptions

Exception or error:

I have an embedded html file in my file system, it works fine if I drag n drop the file to


and I have tested the HTML5 video playback from here. Works fine.

Now, if I want to show an embedded page with HTML5 video [working on browser] as an embedded file, just by changing the sample code for the HTML5 android webView player and drag n drop the index.html in assets for this project, it doesn’t work, the app crashes with this error:

sorry, the app * has stopped unexpectedly…

so I just change




It doesn’t work.

What am I missing, is there a basic example of HTML5 video embedded?

How to solve:

Try putting index.html in assets/www/index.html and change mWebView.loadUrl("file:///android_asset/index.html"); to mWebView.loadUrl("file:///android_asset/www/index.html");


Try using loadDataWithBaseURL:

String baseUrl = shouldUseCachedFiles ? "file:///android_asset/"
mWebView.loadDataWithBaseURL(baseUrl, htmlContent, "text/html",
                        "utf-8", baseUrl);

where the htmlContent is retrieved with an AsynchTask and loaded into the webView.

Leave a Reply

Your email address will not be published. Required fields are marked *