Since there is no current implementation of the fullscreen Element according to MDN what is a proper workaround to check if a fullscreen video on mobile Safari iOS (iPhone, not iPad(!)) is exited and then fire an event (for example to hide the video element)?
Currently I listen for the changeFullScreen event and then trigger a function that checks if a fullscreenElement is present so I don't close the video when it opens (since this triggers the same event).
It seems I can check all other browsers except this one, and refuse to believe this is true.
My code so far (VueJS):
document.addEventListener('fullscreenchange', this.onFullScreenChange)
document.addEventListener('webkitfullscreenchange', this.onFullScreenChange)
document.addEventListener('mozfullscreenchange', this.onFullScreenChange)
document.addEventListener('msfullscreenchange', this.onFullScreenChange)
onFullScreenChange() {
if (
!document.fullscreenElement &&
!document.webkitFullscreenElement &&
!document.mozFullScreenElement
)
this.closeVideo()
},
Works perfectly on all tested browsers except mobile Safari where when the user closes the fullscreen the video just stops and stays open.