WebView Client not able to load video


Last Updated:

  1. Pratush

    Pratush Member This Topic's Starter

    Joined:
    Sep 15, 2010
    Messages:
    6
    Likes Received:
    0
    Hi,
    when I browse with the normal Browser to
    m.youtube.com and click a video it starts fine.

    I have made a simple WebviewClient
    webview.setWebViewClient(new HelloWebViewClient()
    and a webview.setWebChromeClient(new WebChromeClient()

    that works perfect with normal html pages.
    but when I click on a video link, like on Youtube.
    NOTHING happens. Even I dont see any error in the adb log.

    What Do I have to activate or implement in my WebViewclient
    or WebChomeClient???

    Thanks in advance.
    -pratush
     

    Advertisement
  2. anqe1ki11er

    anqe1ki11er New Member

    Joined:
    Mar 27, 2010
    Messages:
    2
    Likes Received:
    0
    You will most likely have to override WebViewClient's onLoadResource() method, and handle the video playback yourself. For example:

    Code (Text):
    1. @Override
    2. public void onLoadResource(WebView view, String url) {
    3.     Log.i("onLoadResource()", "url = " + url);
    4.     if (url.endsWith(".3gp")) {
    5.         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    6.         view.getContext().startActivity(intent);
    7.     }
    8. }
     

Share This Page

Loading...