Anu
Anu

Reputation: 1

how to play YouTube video with fullscreen in android application

I want to play the YouTube video in fullscreen mode by default in my Android application. I have tried with the options force_full screen and flag_full screen, but nothing is working.Can you please help me on this?

Thanks.

Upvotes: 0

Views: 2412

Answers (2)

Evgen Orlovsky
Evgen Orlovsky

Reputation: 101

you can use this code, if you use YouTube SDK

player.setPlaybackEventListener(new YouTubePlayer.PlaybackEventListener() {
                    @Override
                    public void onPlaying() {
                        player.setFullscreen(true);
                    }

                    @Override
                    public void onPaused() {

                    }

                    @Override
                    public void onStopped() {

                    }

                    @Override
                    public void onBuffering(boolean b) {

                    }

                    @Override
                    public void onSeekTo(int i) {

                    }
                });

Upvotes: 0

Ozan
Ozan

Reputation: 1201

This should be work:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com  /watch?v=VIDEOID"));
intent.putExtra("force_fullscreen",true); 
startActivity(intent);

Thanks DagW

Upvotes: 3

Related Questions