1

I want to play videos in website (which is displayed in android webview).I have locally store all html pages and videos into assets folder of android project and i am displaying website from that assets folder into web view.

The problem is that in web site there are some videos and it is not played in android web view ( it just display me loading circle ) .I tried setpluging on , javascript on , i tried iframe in Html and Video and video src TAG in html but no luck to play video files locally.

Any budy please help me to play video files on web page which loaded on webview of android Thank you

oncreate(){
 setContentView(R.layout.activity_main);
 WebView webView= (WebView)findViewById(R.id.webView);
 webView.getSettings().setSupportZoom(true);
 webView.getSettings().setBuiltInZoomControls(true);
 webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
 webView.setScrollbarFadingEnabled(true);
 webView.getSettings().setLoadsImagesAutomatically(true);
 webView.setWebChromeClient(new WebChromeClient());
 webView.setWebViewClient(new WebViewClient());  
 WebSettings webSettings = webView.getSettings();
 webSettings.setJavaScriptEnabled(true);
 webSettings.setPluginState(WebSettings.PluginState.ON);
   webView.loadUrl("file:///android_asset/index.html");

}

<video width="320" height="240" controls="controls" name="media">
              <source src="twitter.mp4" type="video/mp4">// i tried src="file:///android_asset/twitter.mp4" but no luck 
                </video>
  • @RaghavSood please exactly tell me what to do..i read all post and i dont get my answer...i want to play video from assets to web page which is loaded in web view.... or any other solution.. –  Feb 22 '13 at 17:29
  • @RaghavSood i am confuse totally confuse what to do..i just want to play video files which is store in asset folder on my locally loaded webpage...please share any sample code please. –  Feb 22 '13 at 17:34
  • IIRC there might be a size limit on assets of 1MB. How big is your video? Also do you know if it's correctly encoded for your device? – Offbeatmammal Feb 23 '13 at 21:10
  • @Offbeatmammal my video is 20mb..on reading documentation i found that i can not play video from assets i need to have in sd card..so i will copy all folder to sd card and than play from there..but problem is that how can i have functionality like this " When user click on video than popup frame come out and into that pop up frame video is played(may be i can use videosurface in framelayout) and after video finish web view displaed...i dont know how can i achiche this thing..any guidance as per my code.. –  Feb 24 '13 at 22:51

0 Answers0