开发者

How to webview return to the last url after playing video?

开发者 https://www.devze.com 2023-02-28 00:34 出处:网络
there is a webview with video links ,after finish playing a video in media player,the media player close and returns to webview ,but webview loads its original url instead of the url that I click the

there is a webview with video links ,after finish playing a video in media player,the media player close and returns to webview ,but webview loads its original url instead of the url that I click the video link,I wander how to return to the last url after the media playe开发者_如何学编程r close? thx very much!


You can detect the url changes in your webview, setWebViewClient method of webview and then implement a new webViewClient, then you can access full url by using onPageFinished method. see code below.

webView.setWebViewClient(new WebViewClient()
{

    @Override
    public void onPageFinished(WebView view, String url)
    {
        //save url in a static variable so that this will ensure it will be the last url that will be loaded
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号