0

im trying to play a video in VideoView on an android application. the question is how do i fetch the correct link to the video from youtube and not just the webpage?

setContentView(R.layout.videopopup);
VideoView vv = (VideoView)findViewById(R.id.videoElem);

MediaController mc = new MediaController(this);
mc.setEnabled(true);
mc.show(0);
vv.setMediaController(mc); 
vv.setVideoURI(Uri.parse("http://www.youtube.com/v/oFL2rszPmmU?version=3&feature=player_detailpage"));
vv.requestFocus();
vv.showContextMenu();
vv.start();  

in this link: Video View not playing youtube video

Evgeny Nacu explains which link it should be, but not how to retrieve it from a given youtube page.

Community
  • 1
  • 1
j l
  • 61
  • 1
  • 2
  • 11
  • check this link http://keyeslabs.com/joomla/blogs/i-think-im-becoming-an-android/51-polish-your-app-free-embeddable-android-youtube-activity – Ganesh K Jun 20 '12 at 09:18
  • https://developers.google.com/youtube/2.0/developers_guide_protocol_audience – Ganesh K Jun 20 '12 at 09:20

1 Answers1

0

Simple way to play video using default youtube app:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(your youtube url);

Youtube app will do everything. You need not do anything.

and if that doesn't solve, use webview instead of videoview in your code

Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109