2

I am using the following code to play youtube videos in my app.

startActivity(new Intent(Intent.ACTION_VIEW, 
                         Uri.parse("http://www.youtube.com/watch?v=videoid")));

I would like the youtube videos to open in full screen mode. Is there any way to achieve this?

ambit
  • 1,099
  • 2
  • 28
  • 43
  • possible duplicate of [Android YouTube app Play Video Intent](http://stackoverflow.com/questions/574195/android-youtube-app-play-video-intent) – RvdK Jun 19 '12 at 20:00
  • thanks.. but I don't think your link covers playing of videos in full screen. In my app, videos are getting played, but the youtube videos are not fullscreen and I have to do that manually as of now. – ambit Jun 19 '12 at 20:06
  • I'm also looking for an answer for this question. I think gdata apis could be of some help. – Harshal Kshatriya Jun 23 '12 at 12:00
  • Try using open youtube player. This has helped me. This is the link for it: http://keyeslabs.com/joomla/projects/youtube-player/244-open-youtube-activity-project-launched-by-keyes-labs – ambit Jul 18 '12 at 09:50
  • http://code.google.com/p/android-youtube-player/source/checkout – Ganesh K Aug 31 '12 at 12:59

3 Answers3

12

Found this solution today:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=VIDEOID"));
intent.putExtra("force_fullscreen",true); 
startActivity(intent);
DagW
  • 955
  • 1
  • 15
  • 28
3

Try using

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube://" + video_id);
startActivity(intent);

The reason is the different Uri. The one you are currently using is just supplying content via http: that happens to be video and get's resolved to youtube. The one with "vnd.youtube" is actually telling the system that you have video content you would like one of the native apps to take care of.

Ahh, if you want to actually play full screen video without using the youtube app (which you can not control) you don't you try to just make your own VideoView? Check out this link playback video full screen

Community
  • 1
  • 1
Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
  • Did you try just creating you own VideoView? – Frank Sposaro Jun 19 '12 at 20:13
  • I tried videoview earlier. But then, there was a problem with the videos not being played. Then I tried out the option in my code mentioned above. The videos are being played, but now I am stuck with this full screen issue.. – ambit Jun 19 '12 at 20:31
  • So your going to have to fix your VideoView playback problem because I don't think your gonna be able to get control of YouTube to make is start in full screen – Frank Sposaro Jun 19 '12 at 20:35
  • I tried using video view. But again, that did not work..I used this link here this time. http://www.keyeslabs.com/joomla/samplecode/introvideoactivity/IntroVideoActivity.java Not sure how this is gonna work.. It would be great if anyone can show me their working code for a videoview streaming youtube videos. – ambit Jun 22 '12 at 07:57
  • yeah couldn't get it working either. It doesn't allow you to force full screen view – UKDataGeek Aug 27 '12 at 23:28
1

Although I failed at this initially, I eventually succeeded by following the instructions at this linkc http://keyeslabs.com/joomla/projects/youtube-player/244-open-youtube-activity-project-launched-by-keyes-labs

Here you create your own video player and the video gets played in it

ambit
  • 1,099
  • 2
  • 28
  • 43