ambit
ambit

Reputation: 1119

play youtube video in full screen mode in my android app

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?

Upvotes: 2

Views: 12927

Answers (3)

DagW
DagW

Reputation: 955

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

Upvotes: 12

ambit
ambit

Reputation: 1119

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

Upvotes: 1

Frank Sposaro
Frank Sposaro

Reputation: 8531

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

Upvotes: 3

Related Questions