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();
|
// 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);
|
const publisher = await this.openviduService.initDefaultPublisher(undefined);
|
||||||
if (publisher) {
|
if (publisher) {
|
||||||
publisher.once('accessDenied', (e: any) => this.handlePublisherError(e));
|
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));
|
publisher.once('streamPlaying', () => (this.streamPlaying = true));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -681,6 +684,23 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
||||||
this.log.e(e.message);
|
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() {
|
private subscribeToVideconferenceDirectives() {
|
||||||
this.prejoinSub = this.libService.prejoin.subscribe((value: boolean) => {
|
this.prejoinSub = this.libService.prejoin.subscribe((value: boolean) => {
|
||||||
this.showPrejoin = value;
|
this.showPrejoin = value;
|
||||||
|
|
|
@ -43,6 +43,8 @@ export class DeviceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async forceUpdate() {
|
async forceUpdate() {
|
||||||
|
this.cameras = [];
|
||||||
|
this.microphones = [];
|
||||||
await this.initializeDevices();
|
await this.initializeDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue