Skip to content

Commit

Permalink
fix: firefox echo; disable audio sink
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaa30 committed Jan 11, 2024
1 parent 58c6cc5 commit bdf144c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ export class HMSAudioTrackSettingsBuilder {
private _deviceId = 'default';
private _advanced: Array<MediaTrackConstraintSet> = [
// @ts-ignore
{ googEchoCancellation: { exact: true } },
{ echoCancellation: { exact: true } },
// @ts-ignore
{ googExperimentalEchoCancellation: { exact: true } },
// { googEchoCancellation: { exact: true } },
// @ts-ignore
// { googExperimentalEchoCancellation: { exact: true } },
// @ts-ignore
{ autoGainControl: { exact: true } },
// @ts-ignore
{ noiseSuppression: { exact: true } },
// @ts-ignore
{ googHighpassFilter: { exact: true } },
// { googHighpassFilter: { exact: true } },
// @ts-ignore
{ googAudioMirroring: { exact: true } },
// { googAudioMirroring: { exact: true } },
];

volume(volume: number) {
Expand Down
8 changes: 4 additions & 4 deletions packages/hms-video-store/src/media/tracks/HMSAudioTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class HMSAudioTrack extends HMSTrack {

setAudioElement(element: HTMLAudioElement | null) {
HMSLogger.d('[HMSAudioTrack]', this.logIdentifier, 'adding audio element', `${this}`, element);
this.audioElement = element;
// this.audioElement = element;
}

/**
Expand Down Expand Up @@ -63,15 +63,15 @@ export class HMSAudioTrack extends HMSTrack {
}
if (!this.audioElement) {
HMSLogger.d('[HMSAudioTrack]', this.logIdentifier, 'no audio element to set output', `${this}`);
this.outputDevice = device;
// this.outputDevice = device;
return;
}
try {
// @ts-ignore
if (typeof this.audioElement.setSinkId === 'function') {
// @ts-ignore
await this.audioElement?.setSinkId(device.deviceId);
this.outputDevice = device;
// await this.audioElement?.setSinkId(device.deviceId);
// this.outputDevice = device;
}
} catch (error) {
HMSLogger.d('[HMSAudioTrack]', 'error in setSinkId', error);
Expand Down
4 changes: 3 additions & 1 deletion packages/hms-video-store/src/media/tracks/HMSVideoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export class HMSVideoTrack extends HMSTrack {
this.reduceSinkCount();
}
}
videoElement.srcObject = new MediaStream([track]);
// videoElement.srcObject = new MediaStream([track]);
videoElement.srcObject = this.stream.nativeStream;
console.log(`DEBUG - HMSVideoTrack.addSinkInternal`, this.stream.nativeStream.getTracks());
this.sinkCount++;
}

Expand Down
1 change: 1 addition & 0 deletions packages/hms-video-store/src/sdk/store/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ class Store {
promises.push(track.setOutputDevice(device));
}
});
console.log(`DEBUG - updateAudioOutputDevice remoteTracks:${promises.length}`, device);
await Promise.all(promises);
}

Expand Down
3 changes: 2 additions & 1 deletion packages/hms-video-store/src/utils/session-description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ export function enableOpusDtx(desc: RTCSessionDescriptionInit): RTCSessionDescri
return desc;
}

return { type: desc.type, sdp: desc.sdp!.replace('useinbandfec=1', 'useinbandfec=1;usedtx=1') };
return desc;
// return { type: desc.type, sdp: desc.sdp!.replace('useinbandfec=1', 'useinbandfec=1;usedtx=1') };
}

0 comments on commit bdf144c

Please sign in to comment.