I have a webview, in which i load a url to a website that has an embed video. The src in the hardcoded html is "abc" which doesn't mean anything, but, on the document ready i change the src to proper src, this is done with jquery. this works great when executing the url in google chrome for example, but on webview, there is an error that says video not found, the src is wrong, ("abc") so jquery and javascript are not working because the method in document ready didnt execute. i called the webview property to execute javascript but still same problem, i will post my code.
Layout
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:padding="10dp"
android:layout_alignParentStart="true" />
OnCreate method in Activity
WebView displayVideo = (WebView)findViewById(R.id.webView);
displayVideo.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}});
WebSettings webSettings = displayVideo.getSettings();
webSettings.setJavaScriptEnabled(true);
displayVideo.getSettings().setAppCacheEnabled(true);
displayVideo.getSettings().setDomStorageEnabled(true);
displayVideo.setWebChromeClient(new WebChromeClient());
displayVideo.loadUrl("http://servidor-cade.com/Conferencias/Flowplayer/flowPlayer.html");
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="inducesmile.com.androidembedvideo" >
<uses-permission android:name="android.permission.INTERNET"/>
<application android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:hardwareAccelerated="true"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
HTML
<div class="flowplayer">
<video id="sourceVideo">
<source type="video/mp4" src="abc" />
</video>
</div>
