I am using webview to render a page having videos, but the videos on the page keep lagging. But the same page works very well in chrome.
I have set android:hardwareAccelerated="true" in manifest file and also have added webView.setWebChromeClient(new WebChromeClient()) to my java file but has not helped much (the rendering is better but still has some lagging). Is there any way to use the chrome features in webview so that lagging of video can be removed.
I am using the following: -
Android 7 (Nougat) in Android TV player.
Thanks in advance !!
Related
I've got a problem playing Youtube(or any) video in react-native's webview on android device. iOS works just fine.
I've already looked at several SO related questions, but everyone seem to suggest two things:
webview.setWebChromeClient(new WebChromeClient()); which is as far as I am concerned default in react-native's webview since few versions later
enable hardware acceleration android:hardwareAccelerated="true" in AndroidManifest.xml (which I have done)
All I got is a rendered player with controls and everything, but black screen.
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?
The problem is WebKit poorly handles redirects for videos. There are videos within webpages from my company's proprietary API. When a video is clicked, the call goes to our API, then redirects to Amazon S3 to get the actual video file. WebKit then tries to "chunk" the video (instead of pre-loading the entire thing) as you would expect. However, S3 has already done that, which causes the playback to be completely broken.
Android 5.x works fine because WebView is based upon Chromium starting in 4.4, which handles the redirect appropriately.
I'm building an app with a WebView thats supposed to play a mp4 video inline (not fullscreen) by html5 "video" tag.
It worked on my tablet(also 4.2), but failed on another target device.
Tested with default browser, always played in fullscreen and can't play second time.
I tried changing Webview Class to VideoEnabledWebView which says could solve most video problem,
but my webview still can't play video inline, only in fullscreen.
Then I install Chrome browser to test, Chrome could play video inline, but it's abnormal.
test image
Did anyone manage to solve it? Help would be much appreciated!
I need to play a youtube video in webview, the link to the video is present in my tag. But when I run my application, only a pic(thumbnail) comes in the place with play icon on it, and after clicking on it, it shows a black screen with a seekbar on it at 00:00 time, and loading symbol on it, but then nothing happens or is shown. It than remains there all day.
I am using Emulator with 4.4 Android.
My code is a follows:-
WebView content = (WebView)findViewById(R.id.webView1);
String html="<html><body>Some text goes here<br>"
+ "<iframe src=\"//www.youtube.com/embed/eu9kMIeS0wQ?rel=0\" height=\"360\" width=\"640\" allowfullscreen=\"\" frameborder=\"0\"/></iframe></body></html>";
content.getSettings().setPluginState(PluginState.ON_DEMAND);
content.getSettings().setJavaScriptEnabled(true);
content.getSettings().setAllowFileAccess(true);
content.setWebChromeClient(new WebChromeClient());
content.setWebViewClient(new WebViewClient());
content.loadDataWithBaseURL("SomeStringForBaseURL", html, "text/html", "UTF-8", "");
I had also included the
android:hardwareAccelerated="true"> In the manifest.
DO I need to add any API's for Youtube or for any other thing. or what sort of mistake I am commencing? Any help will be appreciated. Thanks In Advance.
Well everything is fine, and the video is running nice and fast. Well, the emulator requires flash player to be installed, whereas this code makes videos playable on android devices. If anyone needs the source code, they can use the one above for running the videos in WebView via tag on android.
I am trying to display local flash swfs in the WebView. I have WebView set up and it will happily display local HTML files, but when I try to display Flash, the screen is blank. The flash file is running as I can hear the audio.
Any ideas, or is this just a known issue / bug? I have noticed that most swf players from the android market suffer the same issue.
Thanks,
Jon
In the manifest files set:
Set android:hardwareAccelerated="true"
Source:
Flash video not displaying in WebView for Android 3.0.1