Skip to content

Commit

Permalink
fix(service-providers): only switch to usable devices (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Nov 28, 2022
1 parent fd497c6 commit e3ac690
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions service-providers/agora-rtc/agora-rtc-web/src/agora-rtc-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,19 @@ export class AgoraRTCWeb extends IServiceVideoChat {
this.shareScreen = new AgoraRTCWebShareScreen({ APP_ID });
this.sideEffect.add(() => {
AgoraRTC.onCameraChanged = deviceInfo => {
this.setCameraID(deviceInfo.device.deviceId);
if (deviceInfo.state === "ACTIVE") {
this.setCameraID(deviceInfo.device.deviceId);
}
};
AgoraRTC.onMicrophoneChanged = deviceInfo => {
this.setMicID(deviceInfo.device.deviceId);
if (deviceInfo.state === "ACTIVE") {
this.setMicID(deviceInfo.device.deviceId);
}
};
AgoraRTC.onPlaybackDeviceChanged = deviceInfo => {
this.setSpeakerID(deviceInfo.device.deviceId);
if (deviceInfo.state === "ACTIVE") {
this.setSpeakerID(deviceInfo.device.deviceId);
}
};
return () => {
AgoraRTC.onCameraChanged = undefined;
Expand Down

0 comments on commit e3ac690

Please sign in to comment.