1. Check out our companion app, Forums for Android! Download from Google Play

WebView Client not able to load video

Discussion in 'Application Development' started by Pratush, Sep 15, 2010.

  1. Pratush

    Pratush Member
    Thread Starter
    5

    Sep 15, 2010
    6
    0
    5
    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
    5

    Mar 27, 2010
    2
    0
    5
    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...