Alexander
Alexander

Reputation: 1770

Android How To Get Playing Video Url From WebView

I have a webview. I want to get video url when user start play video that on webview content.

Example Url : https://www.izlesene.com/video/htc-desire-eye-ilk-bakis/7822052#_

Is that possible getting video url(file url which ends with .mp4 ) when video start to play? Or Should I parse html of webview with jsoup and find video url from html?

Upvotes: 1

Views: 5300

Answers (1)

Mick
Mick

Reputation: 25491

You can ask the web view to inform the app it is hosted in of any URL resource it is loading by using the onLoadResource callback of the WebViewClient:

onLoadResource

added in API level 1

  void onLoadResource (WebView view, 
            String url)

Notify the host application that the WebView will load the resource specified by the given url.

More info here: https://developer.android.com/reference/android/webkit/WebViewClient.html#onLoadResource%28android.webkit.WebView,%20java.lang.String%29

Upvotes: 1

Related Questions