我試圖在我的VideoView中播放來自URL的YouTube視頻,但我得到「無法播放視頻錯誤」,波紋管是我的代碼,我做錯了什麼?VideoView無法播放視頻錯誤
public class YoutubeVideoPopUpActivity extends Activity {
private String url;
private VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_youtube_video);
final Intent intent = getIntent();
//url = intent.getStringExtra("Url");
url = "http://www.youtube.com/watch?v=INu_z8Zn2R8";
setUpVideo();
}
private void setUpVideo() {
videoView = (VideoView) findViewById(R.id.videoView);
videoView.setMediaController(new MediaController(this));
videoView.setVideoURI(Uri.parse(url));
}
@Override
protected void onResume() {
super.onResume();
videoView.start();
}
}