title: Video at YouTube mobile website in WebView doesn't work - Android
body: <p>In my WebView I'm loading YouTube official website:
  <a href="http://m.youtube.com/index?desktop_uri=%2F&amp;gl=US#/" rel="nofollow">http://m.youtube.com/index?desktop_uri=%2F&amp;gl=US#/</a></p>
  
  <p>I want the user to be able to choose a video and simply watch it. The WebView doesn't do it so I thought that maybe I should run an intent to youtube app. 
  First, I had to export the videoID from the link.</p>
  
  <p>I tried this code, but it doesn't match the link..:</p>
  
  <pre><code>public class BrowserClient extends WebViewClient {    
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {       
              //Check if YouTube video link
              Log.d("WBC", "loading link: " + url);
              String youTubeLink = "http://m.youtube.com/index?desktop_uri=%2F&amp;gl=US#/watch?xl=xl_blazer&amp;v=";
              if (url.startsWith(youTubeLink)){      
                  Log.d("WBC", "This is a YouTube link: " + url);
                   view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("http://www.youtube.com/v/%s", url.substring(youTubeLink.length(),url.length())))));
                    return true;
              }
  
              return super.shouldOverrideUrlLoading(view, url);
          }
  }
  </code></pre>
  
  <p>Any help?</p>