fix: Prefer H265 when browser supported (#2200)

- Closes #2192
This commit is contained in:
Dermot Duffy
2025-10-06 21:25:50 -07:00
committed by GitHub
parent 9f479f8b4f
commit e2500a853e
@@ -702,7 +702,11 @@ export class VideoRTC extends HTMLElement {
/** @type {MediaStream} */
const stream = video2.srcObject;
if (stream.getVideoTracks().length > 0) rtcPriority += 0x220;
if (stream.getVideoTracks().length > 0) {
// not the best, but a pretty simple way to check a codec
const isH265Supported = this.pc.remoteDescription.sdp.includes('H265/90000');
rtcPriority += isH265Supported ? 0x240 : 0x220;
}
if (stream.getAudioTracks().length > 0) rtcPriority += 0x102;
if (this.mseCodecs.indexOf('hvc1.') >= 0) msePriority += 0x230;