From 17aea37da080ea2d1aadef976b3ee623e7d952fc Mon Sep 17 00:00:00 2001 From: kwesi-dolby Date: Tue, 25 Jul 2023 10:18:45 +0200 Subject: [PATCH] CCSA-155 Open a session to backend in preview screen in order to start a video preview --- .../ConferencePreConfigContainer.js | 5 ++ src/app/components/ConferenceRoom.js | 55 +++++++++++-------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/app/components/ConferencePreConfigContainer.js b/src/app/components/ConferencePreConfigContainer.js index 7bc3daf..21ed7fb 100644 --- a/src/app/components/ConferencePreConfigContainer.js +++ b/src/app/components/ConferencePreConfigContainer.js @@ -423,6 +423,10 @@ class ConferencePreConfigContainer extends Component { } async init() { + if (!VoxeetSDK.session.participant) { + await VoxeetSDK.session.open(this.props.userInfo); + } + let resultAudio = []; let resultVideo = []; let resultAudioOutput = []; @@ -1678,6 +1682,7 @@ ConferencePreConfigContainer.propTypes = { virtualBackgroundMode: PropTypes.string, videoDenoise: PropTypes.bool, virtualBackgroundModeSupported: PropTypes.bool, + userInfo: PropTypes.object, }; export default ConferencePreConfigContainer; diff --git a/src/app/components/ConferenceRoom.js b/src/app/components/ConferenceRoom.js index b16dd4d..6cf7dfc 100644 --- a/src/app/components/ConferenceRoom.js +++ b/src/app/components/ConferenceRoom.js @@ -42,6 +42,30 @@ class ConferenceRoom extends Component { this.handleJoin = this.handleJoin.bind(this); this.initializeControlsStore(); this.startConferenceWithParams = this.startConferenceWithParams.bind(this); + + // Initialize SDK + const { + chatOptions, + consumerKey, + consumerSecret, + oauthToken, + refreshTokenCallback, + } = this.props; + if (oauthToken != null) { + this.initialized = this.props.dispatch( + ConferenceActions.initializeWithToken( + oauthToken, + refreshTokenCallback, + { chatOptions } + ) + ); + } else { + this.initialized = this.props.dispatch( + ConferenceActions.initialize(consumerKey, consumerSecret, { + chatOptions, + }) + ); + } } replayConference(conferenceId) { @@ -85,8 +109,6 @@ class ConferenceRoom extends Component { // constraints, displayModes, displayActions, - consumerKey, - consumerSecret, userInfo, pstnNumbers, autoJoin, @@ -98,12 +120,10 @@ class ConferenceRoom extends Component { handleOnLeave, conferenceReplayId, isAdmin, - oauthToken, disableSounds, dvwc, simulcast, invitedUsers, - refreshTokenCallback, isListener, chatOptions, spatialAudio, @@ -158,23 +178,6 @@ class ConferenceRoom extends Component { ); this.videoDenoise = preConfigPayload.videoDenoise; } - let initialized; - let pinCodeTmp = pinCode; - if (oauthToken != null) { - initialized = this.props.dispatch( - ConferenceActions.initializeWithToken( - oauthToken, - refreshTokenCallback, - { chatOptions } - ) - ); - } else { - initialized = this.props.dispatch( - ConferenceActions.initialize(consumerKey, consumerSecret, { - chatOptions, - }) - ); - } if (handleOnConnect != null) { this.props.dispatch(ParticipantActions.handleOnConnect(handleOnConnect)); @@ -184,6 +187,7 @@ class ConferenceRoom extends Component { setPstnNumbers(pstnNumbers); } + let pinCodeTmp = pinCode; if (pinCodeTmp != null) { if (pinCodeTmp.length !== 8 || !/^\d+$/.test(pinCodeTmp)) { pinCodeTmp = ""; @@ -217,7 +221,7 @@ class ConferenceRoom extends Component { } if (conferenceReplayId != null) { - initialized.then(() => { + this.initialized.then(() => { this.props.dispatch( ConferenceActions.subscribeConference(conferenceAlias) ); @@ -271,7 +275,7 @@ class ConferenceRoom extends Component { ControlsActions.setSimulcast(simulcast); if (isDemo) { - initialized.then(() => + this.initialized.then(() => this.props.dispatch( ConferenceActions.joinDemo(userInfo, spatialAudio) ) @@ -301,7 +305,7 @@ class ConferenceRoom extends Component { ); } */ else if (autoJoin && conferenceReplayId == null) { // Autojoin when entering in fullscreen mode - initialized.then(() => { + this.initialized.then(() => { this.props.dispatch( ConferenceActions.join( conferenceAlias, @@ -732,6 +736,9 @@ class ConferenceRoom extends Component { virtualBackgroundModeSupported={ this.props.virtualBackgroundModeSupported } + userInfo={ + this.props.userInfo + } /> ); } else if (isJoined || !isWidget || conferenceReplayId != null) {