HTML5 Android video plays but not visible

I did a lot of research trying to figure out why the html5 videos would not play correctly in my application. To be more specific, the page loads perfectly, you can see the initial controls of the video player, but when you click on playback, you are here the sound from the video, but you can’t see anything.

I use webview to display it and use several online links for testing, for example:

Here is my webview code:

String _location = "http://broken-links.com/tests/video/"; WebView wv = (WebView) findViewById(R.id.dsWebView); wv.setWebChromeClient(new WebChromeClient()); //chromeClient()); wv.setWebViewClient(new HelloWebViewClient()); WebSettings webSettings = wv.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); webSettings.setUseWideViewPort(true); webSettings.setPluginsEnabled(true); webSettings.setPluginState(PluginState.ON); webSettings.setDomStorageEnabled(true); webSettings.setAllowFileAccess(true); wv.setInitialScale(50); wv.loadUrl(_location); private class HelloWebViewClient extends WebViewClient { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true;//false; } } 

I also modified my project so that it is for android 4.0 and higher and set android: hardwareAccelerated = "true" in my manifest file.

To add, I tested both links in both my default browser on my htc one x and the Chrome beta, and it works fine on both. This is just my webview that doesn't work: (.

I'm mostly trying to figure out what I am missing in order to play the video correctly in my webview.

Thanks for any help in advance,

Fire

+4
source share
2 answers

Finally! I understood my problem. These were my intentional filters in my manifest file. If I published it, someone would probably be able to quickly identify the problem, sorry for that.

 <manifest> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14" /> <supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:icon="@drawable/icon" android:label="@string/app_name" android:hardwareAccelerated="true"> <activity android:name=".Main" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="content" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="file" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> </activity> <activity android:name="myWebView" android:configChanges="keyboardHidden|orientation" ></activity> </application> 

I had to remove the intent filters that I added to run my application from any file using ".test". Basically removing this part and it started working:

  <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="content" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> <intent-filter android:icon="@drawable/icon" android:label="Test File" android:priority="1"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="file" android:host="*" android:pathPattern=".*\\.test"/> </intent-filter> 

Now my next problem is how to run the application from the .test file, if this leads to my html5 not working. (I suppose I can remove the http filter, but I would like to click a link on a web page that downloads and opens my .test file.

+1
source

try this one

 wv.setLayerType(View.LAYER_TYPE_HARDWARE, null); 
+2
source

All Articles