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

Commit

Permalink
Fix: Firefox console errors `TypeError: this.preferredCodec.split is …
Browse files Browse the repository at this point in the history
…not a function` (#310)

* Fix select codec on Firefox

* Restore indentation in cirrus
  • Loading branch information
Belchy06 committed Jul 18, 2023
1 parent d5d8db1 commit 503b565
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion Frontend/library/src/Config/SettingOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,22 @@ export class SettingOption<
public set selected(value: string) {
// A user may not specify the full possible value so we instead use the closest match.
// eg ?xxx=H264 would select 'H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f'
const filteredList = this.options.filter(
let filteredList = this.options.filter(
(option: string) => option.indexOf(value) !== -1
);
if (filteredList.length) {
this.value = filteredList[0];
return;
}

// A user has specified a codec with a fmtp string but this codec + fmtp line isn't available.
// in that case, just use the codec
filteredList = this.options.filter(
(option: string) => option.indexOf(value.split(' ')[0]) !== -1
);
if (filteredList.length) {
this.value = filteredList[0];
return;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ export class PeerConnectionController {
if (RTCRtpReceiver.getCapabilities && this.preferredCodec != '') {
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
if (
transceiver &&
transceiver &&
transceiver.receiver &&
transceiver.receiver.track &&
transceiver.receiver.track.kind === 'video'
transceiver.receiver.track.kind === 'video' &&
// As of 06/2023, FireFox has added RTCRtpReceiver.getCapabilities, but hasn't added the ability to set codec preferences
transceiver.setCodecPreferences
) {
const preferredRTPCodec = this.preferredCodec.split(' ');
const codecs = [
Expand Down

0 comments on commit 503b565

Please sign in to comment.