Android 4.3 WebView will not load url with mp4

644 views Asked by At

I am trying to load a webpage that has an mp4 video on it. It displays a blank screen for android 4.3 (JellyBean) but it works for all versions after that. Any idea why this is?

Below is my code

public class VideoSample extends ActionBarActivity {

    private WebView mWebViewPlayer;

    private String mSampleMp4 = "http://techslides.com/demos/sample-videos/small.mp4";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lime_light);

        mWebViewPlayer = (WebView) findViewById(R.id.limeWebView);

        mWebViewPlayer.getSettings().setJavaScriptEnabled(true);
        mWebViewPlayer.getSettings().setLoadWithOverviewMode(true);
        try {
            mWebViewPlayer.loadUrl(mSampleMp4);
        } catch (Exception e) {

            e.printStackTrace();

        }
    }

}

I am not getting any errors either. I have searched teh forum for a similar problem but Im not having any luck.

2

There are 2 answers

1
Surya Teja Karra On

What if you use setWebViewClient(new WebViewClient()); and setPluginsEnabled(true); to webview?

0
Sivakumar On

Its working after 2 to 3 mins .. kindly wait and test.. its taking time..

kindly check the screen shot of app playing video