DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

html5 in a WebView, detect when video is started

StackOverflow https://stackoverflow.com/questions/10811748
  •   android
  •  | 
  •  
  •  | 
  •   ( words)

Question

In a WebView, I'm trying to load a html5 page where I embed a <video> but is there any way I can detect when the user selects the play button or the video starts playing?

Right now is when I play the video, default is it fires an Intentto open Android's default player, I don't want it to fire an Intent, I want to use a Dialog and play it there. If anybody can give an idea. Thanks.

No correct solution

OTHER TIPS

I do it in this way:

 boolean videoPlay=false;
 webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public Bitmap getDefaultVideoPoster() {
       super.getDefaultVideoPoster();
       videoPlay=true; 
       Log.d("vplayyyyyyyy",String.valueOf(videoPlay));
       return null;
    }
 });

hope this help :)

@Override
public void onCreate(Bundle savedInstanceState) {
    ....
    mywebviewer = (WebView) findViewById(R.id.mywebviewer);
    WebSettings webSettings = mywebviewer.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mywebviewer.loadUrl("https://www.youtube.com");
    mywebviewer.setWebViewClient(new WebViewClient());
}

@Override
public void onBackPressed() {
    if (mywebviewer.canGoBack()) {
          mywebviewer.goBack();
    } else {
        super.onBackPressed();
    }
}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow