Question:
Guys could, through some javascript, make a video on my site not open in full screen on iOS devices?
Because I'm using youtube as a music player and every time someone accesses it on iOS devices it opens the video in full screen. Follow my code with playsinline.
var buildPlayer = function(videoUrl)
{
playerLoading = true;
player = new YT.Player(attrs.container, {
height: '200',
width: '200',
videoId: getIdFromUrl(videoUrl),
playerVars: {
enablejsapi: 1,
playsinline: 1,
html5: 1,
},
events: {
'onReady': onPlayerReady,
'onStateChange': onStateChange
}
});
}
Answer:
In the latest version of the youtube api, you can set the playsinline
parameter to 1
, to find out more, take a look at the documentation:
https://developers.google.com/youtube/player_parameters?csw=1#playsinline