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

Invalid State Error in Firefox #132

Closed
nicokant opened this issue Oct 16, 2020 · 6 comments
Closed

Invalid State Error in Firefox #132

nicokant opened this issue Oct 16, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@nicokant
Copy link

nicokant commented Oct 16, 2020

I have a React application using Daily.co JS in iframe mode, I've implemented a custom button to start screen sharing, but when using in Firefox I receive the following error: getDisplayMedia must be called from a user gesture handler.

Expected behavior

Calling startScreenShare() from an event handler should not trigger the error

Describe the bug (unexpected behavior)

Calling startScreenShare() in firefox throws the following error: InvalidStateError getDisplayMedia must be called from a user gesture handler.
All the following calls throws with error: The request is not allowed by the user agent or the platform in the current context.

Steps to reproduce

This is a brief summary of my component:

class DailyMeeting extends React.Component {
 
 async componentDidMount() {
   this.callFrame = DailyIframe.wrap(this.iframe);
   await this.callFrame.join({ this.props.meetingUrl })
 }
 
  startSharing = () => {
    this.callFrame.startScreenSharing();
  }

  render() {
    return (
      <>
         <iframe
                    frameBorder={0}
                    ref={r => this.iframe = r}
                    allow="camera;microphone;autoplay"
                    style={{
                        width: '100%',
                        height: 'calc(100vh - 128px)',
                    }}
                ></iframe>
         <button onClick={this.startSharing}>start sharing</button>
      </>
    )
  }
}

System information

  • Device: MacBook Air
  • OS, version: OSX 10.15
  • Browser, version: Firefox 81
@nicokant nicokant added the bug Something isn't working label Oct 16, 2020
@philmillman
Copy link

Thanks for the bug report. Do you still get this error if you add display-capture to the allow attribute?

@nicokant
Copy link
Author

Adding display-capture prevents the second error (The request is not allowed by the user agent or the platform in the current context.) to be thrown. Now I still get getDisplayMedia must be called from a user gesture handler. error at every click

@philmillman
Copy link

ok and to confirm: this is FF only?

@nicokant
Copy link
Author

I'm not totally sure, right now I only tried FF and Chrome, in Chrome it works without any problem

@philmillman
Copy link

Ok, I'll escalate on our side. Feel free to reach out on Intercom if it's urgent.

@Regaddi
Copy link
Contributor

Regaddi commented Dec 12, 2023

As of today this seems to not be an issue anymore. I vaguely remember having a conversation about this issue, but that's a while ago obviously. Closing now.

@Regaddi Regaddi closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants