I am trying to build an app with a webview on it that allows youtube playback . Right now the site of youtube is loading and i can click on the video but all I can hear is the sound of it and can't see anything .Would really be grateful for some help on the issue. The app is loaded on samsung galaxy s . sdk version 8.
import com.keyes.youtube.OpenYouTubePlayerActivity;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
public class Youtube extends Activity {
private WebView mWebView;
private String extra;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
extra = getIntent().getStringExtra("VideosId");
mWebView = (WebView) findViewById(R.id.webView1);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setLoadWithOverviewMode(true);// completely zoomed out
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getTouchables();
final Activity activity = this;
mWebView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
activity.setProgress(progress * 1000);
}
});
mWebView.setWebViewClient(new ourViewClient());
mWebView.loadUrl("http://www.youtube.com/watch?v=AIbHWcko0Mg&feature=g-all-bul");
mWebView.setWebViewClient(new ourViewClient());
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}