Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
update to stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
bgarcia committed May 11, 2021
1 parent 188e7d6 commit a58a4dd
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Detail extends Component {
summary: "Customer support",
text: "Customer support",
userPhone: "",
webAppMeetingDomain: "tailwindtradersacs.azurewebsites.net",
webAppMeetingDomain: new URL(window.location.href).host,
isVideoCall: isVideo.toString(),
})
.then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ export default class CallCard extends React.Component {
}

// Get Devices list
componentWillMount() {
async componentWillMount() {
if (this.props.isVideoCall !== "true") {
this.setState({ chatView: true });
this.handleMicOnOff();
this.handleVideoOnOff();
}
if (this.call) {
const cameraDevices = this.deviceManager.getCameraList();
const speakerDevices = this.deviceManager.getSpeakerList();
const microphoneDevices = this.deviceManager.getMicrophoneList();
const cameraDevices = await this.deviceManager.getCameras();
const speakerDevices = await this.deviceManager.getSpeakers();
const microphoneDevices = await this.deviceManager.getMicrophones();

cameraDevices.map((cameraDevice) => {
return this.state.cameraDeviceOptions.push({
Expand Down Expand Up @@ -79,13 +79,11 @@ export default class CallCard extends React.Component {
});

e.removed.forEach((removedCameraDevice) => {
this.state.cameraDeviceOptions.forEach((value, index) => {
this.state.cameraDeviceOptions.forEach(async (value, index) => {
if (value.key === removedCameraDevice.id) {
this.state.cameraDeviceOptions.splice(index, 1);
if (
removedCameraDevice.id === this.state.selectedCameraDeviceId
) {
const cameraDevice = this.deviceManager.getCameraList()[0];
if (removedCameraDevice.id === this.state.selectedCameraDeviceId) {
const cameraDevice = await this.deviceManager.getCameras()[0];
this.setState({ selectedCameraDeviceId: cameraDevice.id });
}
}
Expand All @@ -110,27 +108,27 @@ export default class CallCard extends React.Component {

e.removed.forEach((removedAudioDevice) => {
if (removedAudioDevice.deviceType === "Speaker") {
this.state.speakerDeviceOptions.forEach((value, index) => {
this.state.speakerDeviceOptions.forEach(async (value, index) => {
if (value.key === removedAudioDevice.id) {
this.state.speakerDeviceOptions.splice(index, 1);
if (
removedAudioDevice.id === this.state.selectedSpeakerDeviceId
) {
const speakerDevice = this.deviceManager.getSpeakerList()[0];
const speakerDevice = await this.deviceManager.getSpeakers()[0];
this.deviceManager.setSpeaker(speakerDevice);
this.setState({ selectedSpeakerDeviceId: speakerDevice.id });
}
}
});
} else if (removedAudioDevice.deviceType === "Microphone") {
this.state.microphoneDeviceOptions.forEach((value, index) => {
this.state.microphoneDeviceOptions.forEach(async (value, index) => {
if (value.key === removedAudioDevice.id) {
this.state.microphoneDeviceOptions.splice(index, 1);
if (
removedAudioDevice.id ===
this.state.selectedMicrophoneDeviceId
) {
const microphoneDevice = this.deviceManager.getMicrophoneList()[0];
const microphoneDevice = await this.deviceManager.getMicrophones()[0];
this.deviceManager.setMicrophone(microphoneDevice);
this.setState({
selectedMicrophoneDeviceId: microphoneDevice.id,
Expand Down Expand Up @@ -276,8 +274,8 @@ export default class CallCard extends React.Component {
}
await this.watchForCallFinishConnecting();
if (this.state.videoOn) {
const cameraDeviceInfo = this.deviceManager
.getCameraList()
const cameraDeviceInfo = await this.deviceManager
.getCameras()
.find((cameraDeviceInfo) => {
return cameraDeviceInfo.id === this.state.selectedCameraDeviceId;
});
Expand All @@ -293,8 +291,8 @@ export default class CallCard extends React.Component {
if (this.call.localVideoStreams[0]) {
await this.call.stopVideo(this.call.localVideoStreams[0]);
} else {
const cameraDeviceInfo = this.deviceManager
.getCameraList()
const cameraDeviceInfo = await this.deviceManager
.getCameras()
.find((cameraDeviceInfo) => {
return cameraDeviceInfo.id === this.state.selectedCameraDeviceId;
});
Expand Down Expand Up @@ -337,9 +335,9 @@ export default class CallCard extends React.Component {
}
};

cameraDeviceSelectionChanged = (event, item) => {
const cameraDeviceInfo = this.deviceManager
.getCameraList()
cameraDeviceSelectionChanged = async (event, item) => {
const cameraDeviceInfo = await this.deviceManager
.getCameras()
.find((cameraDeviceInfo) => {
return cameraDeviceInfo.id === item.key;
});
Expand All @@ -348,19 +346,19 @@ export default class CallCard extends React.Component {
this.setState({ selectedCameraDeviceId: cameraDeviceInfo.id });
};

speakerDeviceSelectionChanged = (event, item) => {
const speakerDeviceInfo = this.deviceManager
.getSpeakerList()
speakerDeviceSelectionChanged = async (event, item) => {
const speakerDeviceInfo = await this.deviceManager
.getSpeakers()
.find((speakerDeviceInfo) => {
return speakerDeviceInfo.id === item.key;
});
this.deviceManager.setSpeaker(speakerDeviceInfo);
this.setState({ selectedSpeakerDeviceId: speakerDeviceInfo.id });
};

microphoneDeviceSelectionChanged = (event, item) => {
const microphoneDeviceInfo = this.deviceManager
.getMicrophoneList()
microphoneDeviceSelectionChanged = async (event, item) => {
const microphoneDeviceInfo = await this.deviceManager
.getMicrophones()
.find((microphoneDeviceInfo) => {
return microphoneDeviceInfo.id === item.key;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export default class Meeting extends React.Component {
}

// Get device list
getDevicesList = () => {
const cameraDevices = this.deviceManager?.getCameras();
const speakerDevices = this.deviceManager?.getSpeakers();
const microphoneDevices = this.deviceManager?.getMicrophones();
getDevicesList = async () => {
const cameraDevices = await this.deviceManager?.getCameras();
const speakerDevices = await this.deviceManager?.getSpeakers();
const microphoneDevices = await this.deviceManager?.getMicrophones();
console.log(cameraDevices[0]);
this.setState({
selectedCameraDeviceId: cameraDevices[0]?.id,
Expand Down Expand Up @@ -80,8 +80,8 @@ export default class Meeting extends React.Component {
});
};

componentDidMount() {
this.provisionNewuser();
async componentDidMount() {
await this.provisionNewuser();
let queries = queryString.parse(
decodeURIComponent(this.props.location.search)
);
Expand All @@ -92,8 +92,8 @@ export default class Meeting extends React.Component {
this.setState({ userName: e.target.value });
};

handleJoinCall = () => {
this.joinTeamsMeeting();
handleJoinCall = async () => {
await this.joinTeamsMeeting();
};

// Provisioning new ACS user
Expand Down Expand Up @@ -178,7 +178,7 @@ export default class Meeting extends React.Component {


// Join teams meeting
joinTeamsMeeting = () => {
joinTeamsMeeting = async () => {
try {
let queries = queryString.parse(
decodeURIComponent(this.props.location.search)
Expand All @@ -195,7 +195,7 @@ export default class Meeting extends React.Component {
{
meetingLink: this.meetingLink,
},
this.getCallOptions()
await this.getCallOptions()
);
} else if (
!this.meetingLink &&
Expand All @@ -212,7 +212,7 @@ export default class Meeting extends React.Component {
tenantId: this.tenantId,
organizerId: this.organizerId,
},
this.getCallOptions()
await this.getCallOptions()
);
} else {
throw new Error(
Expand All @@ -225,7 +225,7 @@ export default class Meeting extends React.Component {
}
};

getCallOptions = () => {
getCallOptions = async () => {
let queries = queryString.parse(
decodeURIComponent(this.props.location.search)
);
Expand All @@ -238,7 +238,7 @@ export default class Meeting extends React.Component {
},
};

const cameraDevice = this.deviceManager.getCameraList()[0];
const cameraDevice = await this.deviceManager.getCameras()[0];
if (!cameraDevice || cameraDevice.id === "camera:") {
this.setState({ showCameraNotFoundWarning: true });
} else if (cameraDevice) {
Expand All @@ -247,15 +247,15 @@ export default class Meeting extends React.Component {
callOptions.videoOptions = { localVideoStreams: [localVideoStream] };
}

const speakerDevice = this.deviceManager.getSpeakerList()[0];
const speakerDevice = await this.deviceManager.getSpeakers()[0];
if (!speakerDevice || speakerDevice.id === "speaker:") {
this.setState({ showSpeakerNotFoundWarning: true });
} else if (speakerDevice) {
// this.setState({ selectedSpeakerDeviceId: speakerDevice.id });
this.deviceManager.setSpeaker(speakerDevice);
}

const microphoneDevice = this.deviceManager.getMicrophoneList()[0];
const microphoneDevice = await this.deviceManager.getMicrophones()[0];
if (!microphoneDevice || microphoneDevice.id === "microphone:") {
this.setState({ showMicrophoneNotFoundWarning: true });
} else {
Expand All @@ -266,9 +266,9 @@ export default class Meeting extends React.Component {
return callOptions;
}

cameraDeviceSelectionChanged = (event, item) => {
const cameraDeviceInfo = this.deviceManager
.getCameraList()
cameraDeviceSelectionChanged = async (event, item) => {
const cameraDeviceInfo = await this.deviceManager
.getCameras()
.find((cameraDeviceInfo) => {
return cameraDeviceInfo.id === item.key;
});
Expand All @@ -277,19 +277,19 @@ export default class Meeting extends React.Component {
this.setState({ selectedCameraDeviceId: cameraDeviceInfo.id });
};

speakerDeviceSelectionChanged = (event, item) => {
const speakerDeviceInfo = this.deviceManager
.getSpeakerList()
speakerDeviceSelectionChanged = async (event, item) => {
const speakerDeviceInfo = await this.deviceManager
.getSpeakers()
.find((speakerDeviceInfo) => {
return speakerDeviceInfo.id === item.key;
});
this.deviceManager.setSpeaker(speakerDeviceInfo);
this.setState({ selectedSpeakerDeviceId: speakerDeviceInfo.id });
};

microphoneDeviceSelectionChanged = (event, item) => {
const microphoneDeviceInfo = this.deviceManager
.getMicrophoneList()
microphoneDeviceSelectionChanged = async (event, item) => {
const microphoneDeviceInfo = await this.deviceManager
.getMicrophones()
.find((microphoneDeviceInfo) => {
return microphoneDeviceInfo.id === item.key;
});
Expand All @@ -312,16 +312,16 @@ export default class Meeting extends React.Component {
/>
<button
className="btn btn-small btn-success mb-4 mx-auto w-50"
onClick={() => {
this.handleLogIn(
onClick={async () => {
await this.handleLogIn(
this.state.userDetails,
this.state.userName
).then(() => {
setTimeout(() => {
this.getDevicesList();
)

setTimeout(async () => {
await this.getDevicesList();
this.setState({ userNameEntered: true });
}, 2000);
});
}}
>
Done
Expand All @@ -332,12 +332,12 @@ export default class Meeting extends React.Component {
<div className="mx-4 mb-4">
<Dropdown
selectedKey={this.state.selectedCameraDeviceId}
onChange={this.cameraDeviceSelectionChanged}
onChange={ async () => await this.cameraDeviceSelectionChanged}
label={"Camera"}
options={this.state.cameraDeviceOptions}
disabled={this.deviceManager?.getCameraList().length === 0}
placeHolder={
this.deviceManager?.getCameraList().length === 0
disabled={async ()=> await this.deviceManager?.getCameras().length === 0}
placeHolder={ async ()=> await
this.deviceManager?.getCameras().length === 0
? "No camera devices found"
: this.state.selectedCameraDeviceId
? ""
Expand All @@ -346,14 +346,14 @@ export default class Meeting extends React.Component {
/>
<Dropdown
selectedKey={this.state.selectedMicrophoneDeviceId}
onChange={this.microphoneDeviceSelectionChanged}
onChange={ async () => await this.microphoneDeviceSelectionChanged}
options={this.state.microphoneDeviceOptions}
label={"Microphone"}
disabled={
this.deviceManager?.getMicrophoneList().length === 0
disabled={async () =>
await this.deviceManager?.getMicrophones().length === 0
}
placeHolder={
this.deviceManager?.getMicrophoneList().length === 0
placeHolder={async () =>
await this.deviceManager?.getMicrophones().length === 0
? "No microphone devices found"
: this.state.selectedMicrophoneDeviceId
? ""
Expand All @@ -365,9 +365,9 @@ export default class Meeting extends React.Component {
onChange={this.speakerDeviceSelectionChanged}
options={this.state.speakerDeviceOptions}
label={"Speaker"}
disabled={this.deviceManager?.getSpeakerList().length === 0}
placeHolder={
this.deviceManager?.getSpeakerList().length === 0
disabled={ async ()=> await this.deviceManager?.getSpeakers().length === 0}
placeHolder={async ()=> await
this.deviceManager?.getSpeakers().length === 0
? "No speaker devices found"
: this.state.selectedSpeakerDeviceId
? ""
Expand All @@ -386,7 +386,7 @@ export default class Meeting extends React.Component {
style: { verticalAlign: "middle", fontSize: "large" },
}}
text={this.isVideoCall === "true" ? "Join meeting" : "Chat"}
onClick={this.joinTeamsMeeting}
onClick={async () => await this.joinTeamsMeeting() }
></PrimaryButton>
</div>
) : (
Expand Down

0 comments on commit a58a4dd

Please sign in to comment.