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

CCS 4603/CCU-309 #271

Merged
merged 6 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/app/actions/ConferenceActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Actions as OnBoardingMessageActions } from "./OnBoardingMessageActions"
import { Actions as OnBoardingMessageWithActionActions } from "./OnBoardingMessageWithActionActions";
import { Actions as OnBoardingMessageWithConfirmationActions } from "./OnBoardingMessageWithConfirmationActions";
import { Actions as TimerActions } from "./TimerActions";
import {Actions as ActiveSpeakerActions} from "./ActiveSpeakerActions"
import { strings } from "../languages/localizedStrings.js";
import { getVideoDeviceName } from "../libs/getVideoDeviceName";
import { isElectron, isIOS } from "../libs/browserDetection";
Expand Down Expand Up @@ -1256,7 +1257,7 @@ export class Actions {
static checkIfUpdateStatusUser(user) {
return (dispatch, getState) => {
const {
voxeet: { participants },
voxeet: { participants,activeSpeaker },
} = getState();
const index = participants.participants.findIndex(
(p) => p.participant_id === user.id
Expand All @@ -1275,6 +1276,14 @@ export class Actions {
user.status
)
);
if(user.status==="Left"){
if(user.id === activeSpeaker?.activeSpeaker?.participant_id)
dispatch(ActiveSpeakerActions.stopActiveSpeaker())
if (participants.participants.filter(p => p.status !== "Left").length === 0){
dispatch(ControlsActions.forceMode('tiles'))
}
}

}
dispatch(
ParticipantWaitingActions.onParticipantWaitingStatusUpdated(
Expand All @@ -1289,13 +1298,21 @@ export class Actions {
static checkIfUpdateUser(user, stream) {
return (dispatch, getState) => {
const {
voxeet: { participants },
voxeet: { participants,activeSpeaker },
} = getState();
const index = participants.participants.findIndex(
(p) => p.participant_id === user.id
);
if (index !== -1 || VoxeetSDK.session.participant.id === user.id)
if (index !== -1 || VoxeetSDK.session.participant.id === user.id){
dispatch(ParticipantActions.onParticipantUpdated(user, stream));
if(user.status ==="Left"){
if(user.id === activeSpeaker?.activeSpeaker?.participant_id || activeSpeaker?.activeSpeaker === null)
dispatch(ActiveSpeakerActions.disableForceActiveSpeaker());
if (participants.participants.length <= 1){
dispatch(ControlsActions.forceMode('tiles'))
}
}
}
};
}

Expand Down Expand Up @@ -1508,6 +1525,9 @@ export class Actions {
if (VoxeetSDK.session.participant.id === user.id) {
dispatch(ControlsActions.toggleScreenShareMode(false));
}
else {
dispatch(ControlsActions.restoreMode());
}
} else {
// VFS
dispatch(ForwardedVideoActions.updateForwardedVideos());
Expand Down
6 changes: 6 additions & 0 deletions src/app/actions/ControlsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const Types = {
SHARE_ACTIONS_ALLOWED: "SHARE_ACTIONS_ALLOWED",
TOGGLE_MODAL: "TOGGLE_MODAL",
FORCE_MODE: "FORCE_MODE",
RESTORE_MODE: "RESTORE_MODE",
TOGGLE_SCREEN_SHARE_MODE: "TOGGLE_SCREEN_SHARE_MODE",
TOGGLE_FILE_PRESENTATION_MODE: "TOGGLE_FILE_PRESENTATION_MODE",
TOGGLE_VIDEO_PRESENTATION_MODE: "TOGGLE_VIDEO_PRESENTATION_MODE",
Expand Down Expand Up @@ -112,6 +113,11 @@ export class Actions {
},
};
}
static restoreMode(){
return{
type:Types.RESTORE_MODE
}
}

static toggleScreenShareMode(isScreenshare) {
return {
Expand Down
8 changes: 6 additions & 2 deletions src/app/components/ConferencePreConfigContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ class ConferencePreConfigContainer extends Component {
VoxeetSDK.video.local.removeListener("videoStarted", this.onVideoStarted);
VoxeetSDK.video.local.removeListener("videoUpdated", this.onVideoUpdated);

this.releaseAudioStream().then(() => this.releaseVideoStream());
if (this.state.userVideoStream)
VoxeetSDK.video.local.stop();

if (this.state.userAudioStream)
this.state.userAudioStream.getTracks().forEach(track => track.stop());

}

reportError(error) {
Expand Down Expand Up @@ -280,7 +285,6 @@ class ConferencePreConfigContainer extends Component {
async releaseVideoStream() {
if (this.state.userVideoStream) {
await VoxeetSDK.video.local.stop();

this.setState({
userVideoStream: null,
});
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/attendees/AttendeesSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ class AttendeesSettings extends Component {
this.setState({ videoDenoise: this.props.controlsStore.videoDenoise });
}

if (
if (this.props.controlStore && this.props.controlStore.displayAttendeesList && (
this.props.controlsStore.videoEnabled !==
prevProps.controlsStore.videoEnabled ||
this.props.controlsStore.audioEnabled !==
prevProps.controlsStore.audioEnabled
)
) {
this.initDevices();
}
Expand Down
1 change: 1 addition & 0 deletions src/app/components/attendees/modes/ActiveSpeakerOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ActiveSpeakerOverlay extends Component {

componentWillUnmount() {
this.props.dispatch(ActiveSpeakerActions.stopActiveSpeaker());
clearTimeout(this.hideTimer)
}

componentDidUpdate(prevProps, prevState) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/attendees/modes/SpeakerActive.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class SpeakerActive extends Component {
className={mySelf ? "stream-media myself" : "stream-media"}
>
<AttendeesParticipantVideo
muted={false}
muted={true}
stream={participant.stream}
enableDbClick={false}
/>
Expand Down
24 changes: 20 additions & 4 deletions src/app/reducers/ControlsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const defaultState = {
isKickOnHangUpActived: false,
recordingLocked: false,
simulcast: false,
modeSaved:[],
modalOpened: true,
displayActions: [
"mute",
Expand Down Expand Up @@ -84,9 +85,21 @@ const ControlsReducer = (state = defaultState, action) => {
case Types.FORCE_MODE:
return {
...state,
modeSaved: state.mode,
modeSaved: [...state.modeSaved,state.mode],
mode: action.payload.mode,
};
case Types.RESTORE_MODE:
if(!state.modeSaved.length)
return{
...state
}
let tmp = state.modeSaved.pop();
return{
...state,
modeSaved: state.modeSaved,
mode:tmp
}

case Types.SET_CHROME_EXTENSION_ID:
return {
...state,
Expand All @@ -106,19 +119,22 @@ const ControlsReducer = (state = defaultState, action) => {
return {
...state,
isScreenshare: action.payload.isScreenshare,
mode: action.payload.isScreenshare ? state.mode : state.modeSaved,
mode: action.payload.isScreenshare ? state.mode : state.modeSaved.pop(),
modeSaved:state.modeSaved
};
case Types.TOGGLE_VIDEO_PRESENTATION_MODE:
return {
...state,
isVideoPresentation: action.payload.isVideoPresentation,
mode: action.payload.isVideoPresentation ? state.mode : state.modeSaved,
mode: action.payload.isVideoPresentation ? state.mode : state.modeSaved.pop(),
modeSaved:state.modeSaved
};
case Types.TOGGLE_FILE_PRESENTATION_MODE:
return {
...state,
isFilePresentation: action.payload.isFilePresentation,
mode: action.payload.isFilePresentation ? state.mode : state.modeSaved,
mode: action.payload.isFilePresentation ? state.mode : state.modeSaved.pop(),
modeSaved:state.modeSaved
};
case Types.TOGGLE_FULLSCREEN:
const fullScreenStatus = !state.isWidgetFullScreenOn;
Expand Down
3 changes: 2 additions & 1 deletion src/app/reducers/ParticipantsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ const ParticipantReducer = (state = defaultState, action) => {
participants[index].stream = null;
if (
action.payload.stream &&
action.payload.stream.getVideoTracks().length > 0
action.payload.stream.getVideoTracks().length > 0 &&
action.payload.status !== STATUS_LEFT
) {
participants[index] = {
...participants[index],
Expand Down
Loading