play youtube video in full screen mode in my android app

12,290

Solution 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

Solution 2

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);

Solution 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

Share:
12,290
ambit
Author by

ambit

an android developer currently. previous worked on Unix and PL/SQL

Updated on June 04, 2022

Comments

  • ambit
    ambit about 2 years

    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?

  • Frank Sposaro
    Frank Sposaro about 12 years
    Did you try just creating you own VideoView?
  • ambit
    ambit about 12 years
    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..
  • Frank Sposaro
    Frank Sposaro about 12 years
    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
  • ambit
    ambit about 12 years
    I tried using video view. But again, that did not work..I used this link here this time. keyeslabs.com/joomla/samplecode/introvideoactivity/… 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.
  • UKDataGeek
    UKDataGeek almost 12 years
    yeah couldn't get it working either. It doesn't allow you to force full screen view
  • Shamas S
    Shamas S over 8 years
    This is a link only answer. Consider copying relevant information here.