问题
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 ?
回答1:
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();
}
来源:https://stackoverflow.com/questions/13120704/full-screen-option-in-chromeless-player-using-javascript