Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catching "play video" event in Android WebView

in my Android app I have a WebView with basic browsing functionality. My problem is that I want to get notified somehow if the user starts playing a flash video. I tried to set a WebViewClient on my webView, and monitor the URLs in the onLoadResource method, but it doesn't work. My question is the following: is it possible to catch an event of this kind, and if yes, how?

Thanks.

like image 976
overbet13 Avatar asked Oct 18 '13 14:10

overbet13


1 Answers

wv.setOnTouchListener(new View.OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        WebView.HitTestResult hr = ((WebView)v).getHitTestResult();

        return false;
    }
});

Would it not be possible to detect tapping on video play button by html element ID? In the onTouchListener

How is the video displayed? instant play or a button to begin playback?

like image 76
Broak Avatar answered Oct 04 '22 03:10

Broak