From 3581f47d7bf65522f961b28fe503c9b8e3aebfcd Mon Sep 17 00:00:00 2001 From: csantosm <4a.santos@gmail.com> Date: Thu, 31 Mar 2022 17:59:40 +0200 Subject: [PATCH] openvidu-react-native: Allowed join as subscriber Allow join as subscriber Fixed android platform --- openvidu-react-native/App.js | 56 +- .../android/app/build.gradle | 2 +- .../MainApplication.java | 3 +- openvidu-react-native/android/settings.gradle | 2 +- openvidu-react-native/package-lock.json | 26125 ++++++++++++++++ 5 files changed, 26167 insertions(+), 21 deletions(-) create mode 100644 openvidu-react-native/package-lock.json diff --git a/openvidu-react-native/App.js b/openvidu-react-native/App.js index 2af10a1c..c0b33d5f 100644 --- a/openvidu-react-native/App.js +++ b/openvidu-react-native/App.js @@ -31,6 +31,7 @@ export default class App extends Component { speaker: false, joinBtnEnabled: true, isReconnecting: false, + connected: false, }; } @@ -85,7 +86,7 @@ export default class App extends Component { } } - joinSession() { + joinSession(role) { // --- 1) Get an OpenVidu object --- this.OV = new OpenVidu(); @@ -97,6 +98,7 @@ export default class App extends Component { { joinBtnEnabled: false, session: this.OV.initSession(), + role, }, async () => { const mySession = this.state.session; @@ -191,6 +193,7 @@ export default class App extends Component { }, ); } + this.setState({ connected: true }); } catch (error) { console.log('There was an error connecting to the session:', error.code, error.message); this.setState({ @@ -242,6 +245,7 @@ export default class App extends Component { mainStreamManager: undefined, publisher: undefined, joinBtnEnabled: true, + connected: false, }); }); } @@ -308,30 +312,36 @@ export default class App extends Component { render() { return ( - {this.state.mainStreamManager && this.state.mainStreamManager.stream ? ( + {this.state.connected ? ( - - Session: {this.state.mySessionId} - {this.getNicknameTag(this.state.mainStreamManager.stream)} - - + {this.state.mainStreamManager && this.state.mainStreamManager.stream && ( + + Session: {this.state.mySessionId} + {this.getNicknameTag(this.state.mainStreamManager.stream)} + + + )} +