Skip to content

Commit

Permalink
Merge pull request #273 from voxeet/open_session_before_preview_screen
Browse files Browse the repository at this point in the history
CCSA-155 Open a session to backend in preview screen in order to star…
  • Loading branch information
kwesi-dolby authored Jul 26, 2023
2 parents eb997aa + 17aea37 commit 26d4805
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
5 changes: 5 additions & 0 deletions src/app/components/ConferencePreConfigContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -1678,6 +1682,7 @@ ConferencePreConfigContainer.propTypes = {
virtualBackgroundMode: PropTypes.string,
videoDenoise: PropTypes.bool,
virtualBackgroundModeSupported: PropTypes.bool,
userInfo: PropTypes.object,
};

export default ConferencePreConfigContainer;
55 changes: 31 additions & 24 deletions src/app/components/ConferenceRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -85,8 +109,6 @@ class ConferenceRoom extends Component {
// constraints,
displayModes,
displayActions,
consumerKey,
consumerSecret,
userInfo,
pstnNumbers,
autoJoin,
Expand All @@ -98,12 +120,10 @@ class ConferenceRoom extends Component {
handleOnLeave,
conferenceReplayId,
isAdmin,
oauthToken,
disableSounds,
dvwc,
simulcast,
invitedUsers,
refreshTokenCallback,
isListener,
chatOptions,
spatialAudio,
Expand Down Expand Up @@ -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));
Expand All @@ -184,6 +187,7 @@ class ConferenceRoom extends Component {
setPstnNumbers(pstnNumbers);
}

let pinCodeTmp = pinCode;
if (pinCodeTmp != null) {
if (pinCodeTmp.length !== 8 || !/^\d+$/.test(pinCodeTmp)) {
pinCodeTmp = "";
Expand Down Expand Up @@ -217,7 +221,7 @@ class ConferenceRoom extends Component {
}

if (conferenceReplayId != null) {
initialized.then(() => {
this.initialized.then(() => {
this.props.dispatch(
ConferenceActions.subscribeConference(conferenceAlias)
);
Expand Down Expand Up @@ -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)
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -732,6 +736,9 @@ class ConferenceRoom extends Component {
virtualBackgroundModeSupported={
this.props.virtualBackgroundModeSupported
}
userInfo={
this.props.userInfo
}
/>
);
} else if (isJoined || !isWidget || conferenceReplayId != null) {
Expand Down

0 comments on commit 26d4805

Please sign in to comment.