Update codecs detection for Safari browsers

This commit is contained in:
Alexey Khit
2023-07-13 16:16:37 +03:00
parent c81e29fe54
commit 9fd40467f2
3 changed files with 11 additions and 9 deletions
+8 -1
View File
@@ -27,7 +27,6 @@ export class VideoRTC extends HTMLElement {
'hvc1.1.6.L153.B0', // H.265 main 5.1 (Chromecast Ultra)
'mp4a.40.2', // AAC LC
'mp4a.40.5', // AAC HE
'null', // for detecting liars (Safari iOS 12)
'flac', // FLAC (PCM compatible)
'opus', // OPUS Chrome, Firefox
];
@@ -241,6 +240,14 @@ export class VideoRTC extends HTMLElement {
this.appendChild(this.video);
// all Safari lies about supported audio codecs
const m = window.navigator.userAgent.match(/Version\/(\d+).+Safari/);
if (m) {
// AAC from v13, FLAC from v14, OPUS - unsupported
const skip = m[1] < '13' ? 'mp4a.40.2' : m[1] < '14' ? 'flac' : 'opus';
this.CODECS.splice(this.CODECS.indexOf(skip));
}
if (this.background) return;
if ('hidden' in document && this.visibilityCheck) {