mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Fixed missing device labels in Firefox
parent
a9854649a4
commit
57c17b50ef
|
@ -217,24 +217,4 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
|||
// this.cd.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
//? After test in Chrome and Firefox, the devices always have labels.
|
||||
//? It's not longer needed
|
||||
// private handlePublisherSuccess(publisher: Publisher) {
|
||||
// publisher.once('accessAllowed', async () => {
|
||||
// if (this.deviceSrv.areEmptyLabels()) {
|
||||
// await this.deviceSrv.forceUpdate();
|
||||
// if (this.hasAudioDevices) {
|
||||
// const audioLabel = publisher?.stream?.getMediaStream()?.getAudioTracks()[0]?.label;
|
||||
// this.deviceSrv.setMicSelected(audioLabel);
|
||||
// }
|
||||
|
||||
// if (this.hasVideoDevices) {
|
||||
// const videoLabel = publisher?.stream?.getMediaStream()?.getVideoTracks()[0]?.label;
|
||||
// this.deviceSrv.setCameraSelected(videoLabel);
|
||||
// }
|
||||
// this.setDevicesInfo();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -451,7 +451,10 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
const publisher = await this.openviduService.initDefaultPublisher(undefined);
|
||||
if (publisher) {
|
||||
publisher.once('accessDenied', (e: any) => this.handlePublisherError(e));
|
||||
publisher.once('accessAllowed', () => (this.participantReady = true));
|
||||
publisher.once('accessAllowed', async () => {
|
||||
await this.handlePublisherSuccess();
|
||||
this.participantReady = true;
|
||||
});
|
||||
publisher.once('streamPlaying', () => (this.streamPlaying = true));
|
||||
}
|
||||
} catch (error) {
|
||||
|
@ -681,6 +684,23 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
this.log.e(e.message);
|
||||
}
|
||||
|
||||
private async handlePublisherSuccess() {
|
||||
// The devices are initialized without labels in Firefox.
|
||||
// We need to force an update after publisher is allowed.
|
||||
if (this.deviceSrv.areEmptyLabels()) {
|
||||
await this.deviceSrv.forceUpdate();
|
||||
if (this.deviceSrv.hasAudioDeviceAvailable()) {
|
||||
const audioLabel = this.participantService.getMyCameraPublisher()?.stream?.getMediaStream()?.getAudioTracks()[0]?.label;
|
||||
this.deviceSrv.setMicSelected(audioLabel);
|
||||
}
|
||||
|
||||
if (this.deviceSrv.hasVideoDeviceAvailable()) {
|
||||
const videoLabel = this.participantService.getMyCameraPublisher()?.stream?.getMediaStream()?.getVideoTracks()[0]?.label;
|
||||
this.deviceSrv.setCameraSelected(videoLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private subscribeToVideconferenceDirectives() {
|
||||
this.prejoinSub = this.libService.prejoin.subscribe((value: boolean) => {
|
||||
this.showPrejoin = value;
|
||||
|
|
|
@ -43,6 +43,8 @@ export class DeviceService {
|
|||
}
|
||||
|
||||
async forceUpdate() {
|
||||
this.cameras = [];
|
||||
this.microphones = [];
|
||||
await this.initializeDevices();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue