Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:12:50+00:00 2026-05-22T23:12:50+00:00

when I view this page on my android device’ default web browser and click

  • 0

when I view this page on my android device’ default web browser and click the first video, it triggers the default video player of my device. It loads and play.

However when I view the same link in my app, using a WebView, it does not open the default video player. What could be the problem?

I’m using the webview code in this link.

I also made the webview in full screen mode like what was said in the docs, is used this code to go fullscreen:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

EDIT: I’m now using the following code, but still not work, any ideas?

package com.example.Playmp4OnWebView;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class PlayMp4OnWebView extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

          WebView webview = new WebView(this);
          setContentView(webview);

          WebSettings webSettings = webview.getSettings();
          webSettings.setJavaScriptEnabled(true);
          webSettings.setSupportZoom(false);
          webSettings.setPluginsEnabled(true);
          webSettings.setAllowFileAccess(true);

          webview.setWebViewClient(new WebViewClient(){

              public boolean shouldOverrideUrlLoading(WebView view, String url){
                   if(url.endsWith(".mp4")){
                        Intent i = new Intent(Intent.ACTION_VIEW);
                        i.setData(Uri.parse(url));
                        startActivity(i); //warning no error handling will cause force close if no media player on phone.
                        return true;
                   }
                   else return false; 
              }});

       //This will load the webpage that we want to see
        webview.loadUrl("http://www.broken-links.com/2010/07/30/encoding-video-for-android/");

     }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:12:51+00:00Added an answer on May 22, 2026 at 11:12 pm

    You have to attach your own WebViewClient and override shouldOverrideUrlLoading() if you detect a URL with a supported video mimetype return true and then launch the default activity with the URL. Here is an untested sample.

    mWebView.setWebViewClient(new WebViewClient(){
    
    public boolean shouldOverrideUrlLoading(Webview view, String url){
         if(url.endsWith(".mp4") || url.endsWith("some other supported type")){
              Intent i = new Intent(Intent.ACTION_VIEW);
              i.setData(Uri.parse(url));
              startActivity(i); //warning no error handling will cause force close if no media player on phone.
              return true;
         }
         else return false; 
    }});
    

    hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what i'm trying to achieve: Home (Table View) > (Click on row)
On this page of Android Development, -at step 6- they say : Instead of
I have a web app that displays a web page in a web view.
Within my application I would like to show a web page within a view
View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string }
Recent conversations with colleagues have produced varying points of view on this matter. What
My create view code like this create VIEW [dbo].[vw_test] AS SELECT 'B' AS rtype,
The offending command that msi executes is: .\devenv.com /command View.Toolbox /setup This fails with
I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.