fscreen icon indicating copy to clipboard operation
fscreen copied to clipboard

fullscreenEnabled is false for Safari and Chrome on iOS

Open theneekz opened this issue 2 years ago • 1 comments

Following the example app and found that on both Safari & Chrome iOS, fscreen.fullscreenEnabled is always false. The native API responds false as well so I don't think it's this package, any ideas on why this is? I am using a local HTTPS react server

theneekz avatar Jan 07 '24 01:01 theneekz

Hey if anyone is still struggling with this issue, I found this thread on StackOverflow. Turns out this is an issue with IOS and other fullscreen libraries like screenful also don't do this check. Try doing this:

try {
    // for most browsers, this will work
    if (isFullscreenEnabled()) {
      fscreen.requestFullscreen(element);
    }

    // for older versions of Safari and IOS, `isFullscreenEnabled` will return false even though it is supported https://stackoverflow.com/a/39083376/10626111
    else if (
      "webkitEnterFullScreen" in element &&
      typeof element.webkitEnterFullScreen === "function"
    ) {
      return element.webkitEnterFullScreen();
    }
} catch (err) {
    console.error("Failed to enter fullscreen:", err);
}

JeffreyJoumjian avatar Feb 05 '24 07:02 JeffreyJoumjian