Open ber8749 opened 5 years ago
I have the same error, even with a different setup but problably always linked to unmounting the component
@ber8749 is this still reproducible? I am not able too follow your code.
@ramiel Can you post some code to reproduce the issue please?
cheers
I changed the implementation and I have not the error anymore. If I'm able to reproduce it again I'll post some code here
@ramiel How did you change the implementation? I'm currently experiencing a similar issue where the user is not able to unpublish before disconnecting.
@Ganesh-grandy Tokbox support about two months back said the issue is specific to screen sharing with Chrome/Windows, hardware acceleration and high video resolutions but should be fixed with Chrome 82.
I was able to work around the issue setting maxResolution: { width: 1920, height: 1080 }
for screen sharing which fixed the issue for me and my users at an acceptable tradeoff.
@enricop89 Yes, this is still a reproducible issue for me.
@ttraenkler Did Tokbox support address this issue publicly? If so, can you point me to the page where they addressed this issue?
@Ganesh-grandy the point is that I don't know what I changed to make it work. Also, I don't use this anymore, sorry
@ber8749 No, it's not public but has been a support request of mine. Have you tried maxResolution 1920x1080?
@ber8749 I tested the code and, to me, the error is in the implementation. You are mounting/unmounting the OTSession and OTPublisher component a lot of time for nothing. The showPublisher
state variable is changed in the publisher events and also in the componentDidMount hook. What's the reason behind this behaviour?
You can achieve the result with this simple app:
import React from "react";
import ReactDOM from "react-dom";
import { OTSession, OTPublisher } from "opentok-react";
export default class App extends React.Component {
state = {
showPublisher: true
};
publisherEventHandlers = {
accessAllowed: event => {
console.log('accessAllowed called');
},
accessDialogOpened: event => {
console.log('accessDialogOpened called');
}
};
componentDidMount() {
}
render() {
const { apiKey, sessionId, token } = this.props.credentials;
return (
<div className="App">
<h1>OTPublisher Test</h1>
{this.state.showPublisher ?
<OTSession
apiKey=""
sessionId=""
token=""
>
<OTPublisher
eventHandlers={this.publisherEventHandlers}
/>
</OTSession>
:
<span>Please Grant the Browser Access to your Camera and Microphone</span>
}
</div>
);
}
}
Hello,
I am encountering a number of JavaScript console errors when unmounting, then subsequently remounting the
OTPublisher
component based on browser device permissions.I am currently using macOS Mojave v.10.14.6 (18G103) and Chrome Version 76.0.3809.132, however I assume any recent version of Chrome will exhibit this behavior.
Reproduction Steps:
class App extends React.Component { state = { showPublisher: true };
publisherEventHandlers = { accessAllowed: event => { console.log('accessAllowed called'); this.setState({ showPublisher: true }); }, accessDialogOpened: event => { console.log('accessDialogOpened called'); this.setState({ showPublisher: false }); } };
componentDidMount() { navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(mediaStream => { console.log('getUserMedia resolved', mediaStream); this.setState({ showPublisher: true }); }).catch(error => { console.log('getUserMedia error', error); }); }
render() { return (
OTPublisher Test
{ this.state.showPublisher ?} }
const rootElement = document.getElementById("root"); ReactDOM.render( , rootElement);