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

[UE5.2] Fix: Firefox console errors TypeError: this.preferredCodec.split is not a function (#310) #312

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading