overbet13
overbet13

Reputation: 1684

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.

Upvotes: 6

Views: 2563

Answers (1)

Broak
Broak

Reputation: 4187

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?

Upvotes: 1

Related Questions