window.player;
window.onYouTubeIframeAPIReady = function () {
player = new YT.Player('player', {
height: '200',
width: '200',
videoId: 'sdfsdfasd',
playerVars: {'playsinline': 1},
events: {
'onReady': app.onPlayerReady,
'onStateChange': app.onPlayerStateChange,
'onError': app.onPlayerError
}
});
In my Cordova iOS app, I set YouTube iframe's playsinline attribute as 1 when the player is ready. However, when I play a video the player goes full screen. There is a post in Google group for YouTube API that says there's an inssue with playsinline
attribute right now and it doesn't work.
The attribute works fine in a simulator, but it doesn't work on a real device. How should I fix this issue?
The problem was solved when I edited the source code inside webViewDidFinishLoad. From below
I added
theWebView.allowsInlineMediaPlayback=YES;