in Education by
I have a webview in my layout file in android app and I want to load a video with html and javascript inside it. the html string that i want to use to load the video is: video= '
' the WebView xml code is: i also enable the javascriop in webview: post_video.getSettings().setJavaScriptEnabled(true) post_video.loadDataWithBaseURL( null, video, "text/html", "UTF-8", null ); but the webview just show the plain text html code instead of video! you can see the result in this screenshot how can i solve this problem? Update: I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Try adding below attributes to webview WebView webview = (WebView) findViewById(R.id.webView1); webview.setWebViewClient(new WebViewClient()); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webview.getSettings().setPluginState(WebSettings.PluginState.ON); webview.getSettings().setMediaPlaybackRequiresUserGesture(false); webview.setWebChromeClient(new WebChromeClient()); webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); Also add android:hardwareAccelerated="true" to application tag in manifest file

Related questions

0 votes
    can anyone help me.. [NSString stringWithFormat:@"document.getElementsByTagName('body')[0].style.textAlign = ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    We have a Xamarin Forms View with just a Toolbar and a WebView. ContentPage xmlns="http://xamarin.com/schemas/2014/ ... " Title="TestApp" x:Class="TestApp.Client.Views.MainPage">...
asked May 22, 2022 in Education by JackTerrance
0 votes
    I am draw some canvas charts on the android webview, and use javascript to change chart just by hiding ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I used a webview to load up a webpage. Is there a way to listen click action to know what hyper ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I want to put a settings icon to the right of a full-width button which when clicked opens an ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Which of the following Attribute is used to include External JS code inside your HTML Document? (a) src ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
0 votes
    I have a List : Old_list =['orders_ce_deduped.01.csv','orders_ce_deduped.02.csv'] I need to get the 01 and 02 part ... = ['01','02'] Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I am building an Android application with Cordova which is running inside a webview. I know I can access ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    What is the ideal place to load the external JavaScript file in your HTML document 1. Towards the beginning of the ... of the webpage 3. Anywhere within the body is good enough...
asked Feb 23, 2021 in Technology by JackTerrance
0 votes
    What is the ideal place to load the external JavaScript file in your HTML document a)Towards the beginning of the body ... of the webpage c)Anywhere within the body is good enough...
asked Oct 8, 2020 in Technology by JackTerrance
...