I am using Youtube Javascript API to develop chromeless player. Can you tell me How to Add / Develop "Full Screen Control" using Javascript on player ?
Asked
Active
Viewed 1.1k times
1 Answers
8
This is not something that currently exists in the YouTube api. Instead you can use the javascript fullscreen api to provide the functionality. Details can be found on MDN here.
https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode
The code sample would look something like this
var player = new YT.player('#my-video');
// Once the user clicks a custom fullscreen button
var el = document.getElementById('#my-player-element-container');
if (el.requestFullScreen) {
el.requestFullScreen();
} else if (el.mozRequestFullScreen) {
el.mozRequestFullScreen();
} else if (el.webkitRequestFullScreen) {
el.webkitRequestFullScreen();
}

Greg Schechter
- 2,291
- 15
- 16
-
What is "player" and why is it not used and what is "new YT"? – tmighty Jun 23 '22 at 14:47