Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable full screen for youtube api

I have an app with fragments and inside those fragments I have frame layout into which I add YouTubePlayerSupportFragment. But when I click full screen then this exception is thrown:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xxx/com.example.xxx.MainActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f040039 (com.example.xxx:id/frame_youtube) for fragment YouTubePlayerSupportFragment{4282a068 #11 id=0x7f040039}

like image 796
bakua Avatar asked Mar 15 '13 10:03

bakua


People also ask

How to disable “YouTube is now fullscreen” message in Firefox?

How to disable “YouTube.com is now fullscreen. Press Esc at any time to exit” message in Firefox When you are watching a YouTube video in Mozilla Firefox, every time you switch to fullscreen mode, the browser shows the following message: YouTube.com is now fullscreen.

Is there a way to do fullscreen on YouTube?

I've added code to do fullscreen ( real full screen, not full window) to my answer on Auto-Full Screen for a Youtube embed. YouTube don't expose fullscreen in their API, but you can call the native browser requestFullScreen () function from the playerStateChange () event from the YouTube API or make your own custom play button like I have.

How to show or hide the full screen button on YouTube?

If you want to show full screen, youTubePlayer.setFullscreen(true); If you want to hide full screen buttonafter full screen or even in the portrait mode the youTubePlayer.setShowFullscreenButton(false); You can also use PlayerStyle Option, provided in the newest API

How do I stop a YouTube video after 6 seconds?

The function indicates that when the player state is 1 (playing), the player should play for six seconds and then call the stopVideo function to stop the video. After the API's JavaScript code loads, the API will call the onYouTubeIframeAPIReady function, at which point you can construct a YT.Player object to insert a video player on your page.


1 Answers

Or you can just disable it by 1 line:

player.setShowFullscreenButton(false);
like image 125
Mateusz Pryczkowski Avatar answered Oct 01 '22 04:10

Mateusz Pryczkowski