Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"requestFullscreen is not a function" in safari iOS #2

Open
pmourelle opened this issue Apr 28, 2018 · 12 comments
Open

"requestFullscreen is not a function" in safari iOS #2

pmourelle opened this issue Apr 28, 2018 · 12 comments

Comments

@pmourelle
Copy link

Trying to get fullscreen display goes white and UI blocked, so there's no way to restore it but reloading page.

@vasilevich
Copy link
Owner

Hello mate, can you please describe your enivorment?

did you use typescript or javascript?
any sample use so I can reproduce? thanks

@pmourelle
Copy link
Author

pmourelle commented Apr 28, 2018

Sure, I'm using JS on react@16. I'm having something like this:

        <Fullscreen
          className={ classes.FullscreenWrapper }
          enabled={this.state.zoom}
          onChange={zoom => this.setState({zoom})}
        >
          <div className={ classes.FreeHandBox }>
            <SignaturePad
              options={{ penColor: 'blue' }}
              redrawOnResize={true}
              ref={localRef => this.canvas = localRef}
            />

            <Button
              bsSize="small"
              onClick={ () => this.clearCanvas() }
              className={ classes.FreeHandCleanCanvas }>
              <Glyphicon glyph="repeat" />
            </Button>

            <Button
              bsSize="small"
              onClick={ () => this.toggleZoom() }
              className={ classes.FreeHandZoomCanvas }>
              <Glyphicon glyph="fullscreen" />
            </Button>
          </div>
        </Fullscreen>

What I'm doing is using react-screen-orientation to be able to go fullscreen when phone is set in landscape. So signature pad gets full screen with 2 simple UI buttons. This works fine in Chrome and Firefox, but for Safari iOS seems to not be able to recognize the requestFullscreen call, and ends with browser completely white (like a broken fullscreen(?) ).
I peeked on your code and prefix seems to be all set good. I'm still debugging it, but if you come across something here please do tell :). Thanks!

PS: what about adding a prop for custom class name? (As the className prop above gets overwritten by component.)

@vasilevich
Copy link
Owner

Hi, this might help you debug,
does the example in this url work for you?
http://fscreen.rafrex.com/

or same result?

@pmourelle
Copy link
Author

image

Damn. So this is some standard Safari thing?

@vasilevich
Copy link
Owner

well I am not sure, seems that way, but maybe there is a specific way to do this in safari? maybe the web browser just can't do it

@pmourelle
Copy link
Author

As I've looked around is a known issue around iOS' Safari not supporting fullscreenAPI. "Solution" so far for me is to disable feature for mobile Safari. Total bummer.

Still this issue exists as it tries to use it and breaks with that message above.

@vasilevich
Copy link
Owner

well if you have a suggestion how to prevent it from running on the problematic platform please make a pull request and I will update the module shortly.

@pmourelle
Copy link
Author

pmourelle commented Apr 29, 2018

@vasilevich this is the error: https://github.com/vasilevich/react-fullscreen-crossbrowser/blob/master/src/index.tsx#L113
The enabled is been missconfused with the element I assume, being undefined when fullscreenAPI support is missing, and null when it do has support but there's no element on fullscreen. So I guess you should use fullscreenEnabled() value there, and if that value is true then go on, if not maybe a console.log() letting dev know the lack of support in the browser being tested.

I'm currently busy and don't have time to code/test/PR it now, but I think fixing so ^ should be enough.

@vasilevich
Copy link
Owner

vasilevich commented Apr 29, 2018

Hi friend, I will gladly add what you asked but I am sorry I have no way of testing it, I don't have any IOS devices available.
I will add what you asked as soon as possible and let you know if you want.
what if I simpley add try{ ... } catch to that block and in the catch enter the console log you mentioned? seems like the easiest way?

@pmourelle
Copy link
Author

I'll be happy to test it when you have it on a branch.

@pleytonsoftware
Copy link

pleytonsoftware commented Apr 7, 2022

Sorry for posting after many years. I thought this would be very useful for those that crashed into ios/safari issues:
https://developer.apple.com/documentation/webkitjs/htmlvideoelement/1633500-webkitenterfullscreen

@annarhughes
Copy link

@pleytonsoftware how did you solve this for using this react-fullscreen-crossbrowser package?
did you override the fullscreen onclick functionality to use webkitenterfullscreen() instead, or remove this package and implement your own solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants