mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
fix(voice): allow av1 and vp9 screen shares in firefox (#3108)
This commit is contained in:
@@ -54,6 +54,7 @@ import {
|
|||||||
supportsAV1,
|
supportsAV1,
|
||||||
supportsDynacast,
|
supportsDynacast,
|
||||||
supportsH265,
|
supportsH265,
|
||||||
|
supportsScalabilityMode,
|
||||||
supportsVideoCodec,
|
supportsVideoCodec,
|
||||||
supportsVP9,
|
supportsVP9,
|
||||||
} from './room/utils.ts';
|
} from './room/utils.ts';
|
||||||
@@ -176,6 +177,7 @@ export {
|
|||||||
supportsAV1,
|
supportsAV1,
|
||||||
supportsDynacast,
|
supportsDynacast,
|
||||||
supportsH265,
|
supportsH265,
|
||||||
|
supportsScalabilityMode,
|
||||||
supportsVideoCodec,
|
supportsVideoCodec,
|
||||||
supportsVP9,
|
supportsVP9,
|
||||||
TrackPublication,
|
TrackPublication,
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ import {
|
|||||||
selectPreferredVideoCodec,
|
selectPreferredVideoCodec,
|
||||||
sleep,
|
sleep,
|
||||||
stopTransceiversForSender,
|
stopTransceiversForSender,
|
||||||
|
supportsScalabilityMode,
|
||||||
supportsVideoCodec,
|
supportsVideoCodec,
|
||||||
usesLegacySVCEncodings,
|
usesLegacySVCEncodings,
|
||||||
} from '../utils.ts';
|
} from '../utils.ts';
|
||||||
@@ -978,6 +979,9 @@ export default class LocalParticipant extends Participant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const videoCodec = opts.videoCodec;
|
const videoCodec = opts.videoCodec;
|
||||||
|
if (!supportsScalabilityMode()) {
|
||||||
|
delete opts.scalabilityMode;
|
||||||
|
}
|
||||||
|
|
||||||
track.on(TrackEvent.Muted, this.onTrackMuted);
|
track.on(TrackEvent.Muted, this.onTrackMuted);
|
||||||
track.on(TrackEvent.Unmuted, this.onTrackUnmuted);
|
track.on(TrackEvent.Unmuted, this.onTrackUnmuted);
|
||||||
@@ -1055,7 +1059,12 @@ export default class LocalParticipant extends Participant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const svcSimulcast = isSVCSimulcast(videoCodec, opts);
|
const svcSimulcast = isSVCSimulcast(videoCodec, opts);
|
||||||
if (isSVCCodec(videoCodec) && !svcSimulcast && track.source !== Track.Source.ScreenShare) {
|
if (
|
||||||
|
isSVCCodec(videoCodec) &&
|
||||||
|
!svcSimulcast &&
|
||||||
|
track.source !== Track.Source.ScreenShare &&
|
||||||
|
supportsScalabilityMode()
|
||||||
|
) {
|
||||||
opts.scalabilityMode = opts.scalabilityMode ?? 'L3T3_KEY';
|
opts.scalabilityMode = opts.scalabilityMode ?? 'L3T3_KEY';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export function supportsDynacast() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function supportsAV1(): boolean {
|
export function supportsAV1(): boolean {
|
||||||
if (isSafari() || isFireFox()) {
|
if (isSafari()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return hasSenderMimeType('video/av1') || hasSenderMimeType('video/av1x');
|
return hasSenderMimeType('video/av1') || hasSenderMimeType('video/av1x');
|
||||||
@@ -80,9 +80,6 @@ export function supportsH265(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function supportsVP9(): boolean {
|
export function supportsVP9(): boolean {
|
||||||
if (isFireFox()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (isSafari()) {
|
if (isSafari()) {
|
||||||
const browser = getBrowser();
|
const browser = getBrowser();
|
||||||
if (browser?.version && compareVersions(browser.version, '16') < 0) {
|
if (browser?.version && compareVersions(browser.version, '16') < 0) {
|
||||||
@@ -133,6 +130,10 @@ function hasSenderMimeType(mimeType: string): boolean {
|
|||||||
return capabilities.codecs.some((codec) => codec.mimeType.toLowerCase() === lower);
|
return capabilities.codecs.some((codec) => codec.mimeType.toLowerCase() === lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function supportsScalabilityMode(): boolean {
|
||||||
|
return !isFireFox();
|
||||||
|
}
|
||||||
|
|
||||||
export function isSVCCodec(codec?: string): boolean {
|
export function isSVCCodec(codec?: string): boolean {
|
||||||
return codec === 'av1' || codec === 'vp9';
|
return codec === 'av1' || codec === 'vp9';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import {
|
|||||||
type LocalTrackPublication,
|
type LocalTrackPublication,
|
||||||
type LocalVideoTrack,
|
type LocalVideoTrack,
|
||||||
type ScreenShareCaptureOptions,
|
type ScreenShareCaptureOptions,
|
||||||
|
supportsScalabilityMode,
|
||||||
Track,
|
Track,
|
||||||
type TrackPublishOptions,
|
type TrackPublishOptions,
|
||||||
type VideoCodec,
|
type VideoCodec,
|
||||||
@@ -265,6 +266,7 @@ function resolveScreenShareEncoding(target: ScreenShareTarget, publishOptions?:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getScreenShareLayeringForCodec(codec: VideoCodec | undefined): ScreenShareLayering {
|
function getScreenShareLayeringForCodec(codec: VideoCodec | undefined): ScreenShareLayering {
|
||||||
|
if (!supportsScalabilityMode()) return {simulcast: false, scalabilityMode: undefined};
|
||||||
return resolveScreenShareLayering({
|
return resolveScreenShareLayering({
|
||||||
codec,
|
codec,
|
||||||
svcSetting: VoiceSettings.getScreenShareScalabilityModeOverride(),
|
svcSetting: VoiceSettings.getScreenShareScalabilityModeOverride(),
|
||||||
|
|||||||
@@ -182,29 +182,12 @@ function getScreenShareCodecPolicyUnsupported(
|
|||||||
'H.265 (HEVC) screen sharing is off by default because it may cause compatibility issues for viewers. We’re working on improving this. Turn on H.265 screen sharing in Advanced settings to use it.',
|
'H.265 (HEVC) screen sharing is off by default because it may cause compatibility issues for viewers. We’re working on improving this. Turn on H.265 screen sharing in Advanced settings to use it.',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (context.firefox) {
|
if (context.firefox && codec === 'h265') {
|
||||||
switch (codec) {
|
return {
|
||||||
case 'av1':
|
supported: false,
|
||||||
return {
|
reason: 'unsupported-browser',
|
||||||
supported: false,
|
detail: 'Firefox doesn\u2019t support H.265 encoding for WebRTC.',
|
||||||
reason: 'unsupported-browser',
|
};
|
||||||
detail: 'Firefox doesn\u2019t support AV1 encoding for WebRTC yet.',
|
|
||||||
};
|
|
||||||
case 'vp9':
|
|
||||||
return {
|
|
||||||
supported: false,
|
|
||||||
reason: 'unsupported-browser',
|
|
||||||
detail: 'Firefox\u2019s WebRTC stack doesn\u2019t expose VP9 as a publishable codec.',
|
|
||||||
};
|
|
||||||
case 'h265':
|
|
||||||
return {
|
|
||||||
supported: false,
|
|
||||||
reason: 'unsupported-browser',
|
|
||||||
detail: 'Firefox doesn\u2019t support H.265 encoding for WebRTC.',
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user