I would like to create a video element that auto-fullscreens when played. From my current understanding, it seems like requestFullscreen is available for non-iOS devices while webkitEnterFullScreen is available for iOS devices. I decided to check out the availability of the said methods on different mobile browsers using this page that checks if requestFullscreen and webkitEnterFullScreen are defined for a video element:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>webkitEnterFullScreen</p>
<div id="webkit" style="width:50px;height:50px;border:1px solid black;background:red;"></div>
<p>requestFullscreen</p>
<div id="request" style="width:50px;height:50px;border:1px solid black;background:red;"></div>
<video id="video"></video>
<script>
let video = document.getElementById("video");
if(video.webkitEnterFullScreen) {
let cb = document.getElementById("webkit");
cb.style.background = "green";
}
if(video.requestFullscreen) {
let cb = document.getElementById("request");
cb.style.background = "green";
}
</script>
</body>
</html>
My results were a bit confusing. requestFullscreen was not defined for iOS Safari/Chrome while webkitEnterFullScreen was (this was expected). However, both requestFullscreen and webkitEnterFullScreen were defined on Chrome android (this was unexpected). Lastly, requestFullscreen was defined but not webkitEnterFullScreen for android FireFox.
So my question is why were both methods defined for android Chrome, and which method should one use on a given browser?