I open youtube video using iframe in webview. It shows default control buttons for video including fullscreen button. How can I call function of fullscreen button by myself? For example, I want go to fullscreen on landscape, but videos open in fullscreen only by tap on fullscreen button or while first loading. I need go to fullscreen while playing video.
I have found function. There is webkitEnterFullScreen
in webkit's video tag: https://developer.apple.com/documentation/webkitjs/htmlvideoelement
So all I need is to get video and execute function through javascript:
playerView.webView?.evaluateJavaScript("document.getElementById('player').contentDocument.getElementsByClassName('video-stream')[0].webkitEnterFullScreen()") { object, error in
print(error)
}