diff --git a/README.md b/README.md index bc32b433..1876cbc5 100644 --- a/README.md +++ b/README.md @@ -997,9 +997,9 @@ Some examples: | Desktop Edge | H264, OPUS, PCMU, PCMA | H264, H265*, AAC, FLAC*, OPUS | H264, H265*, AAC, FLAC*, OPUS, MP3 | no | | Android Chrome 107+ | H264, OPUS, PCMU, PCMA | H264, H265*, AAC, FLAC*, OPUS | H264, H265*, AAC, FLAC*, OPUS, MP3 | no | | Desktop Firefox | H264, OPUS, PCMU, PCMA | H264, AAC, FLAC*, OPUS | H264, AAC, FLAC*, OPUS | no | -| Desktop Safari | H264, H265*, OPUS, PCMU, PCMA | H264, H265, AAC, FLAC* | **no!** | H264, H265, AAC, FLAC* | -| iPad Safari 13+ | H264, H265*, OPUS, PCMU, PCMA | H264, H265, AAC, FLAC* | **no!** | H264, H265, AAC, FLAC* | -| iPhone Safari 13+ | H264, H265*, OPUS, PCMU, PCMA | **no!** | **no!** | H264, H265, AAC, FLAC* | +| Desktop Safari 14+ | H264, H265*, OPUS, PCMU, PCMA | H264, H265, AAC, FLAC* | **no!** | H264, H265, AAC, FLAC* | +| iPad Safari 14+ | H264, H265*, OPUS, PCMU, PCMA | H264, H265, AAC, FLAC* | **no!** | H264, H265, AAC, FLAC* | +| iPhone Safari 14+ | H264, H265*, OPUS, PCMU, PCMA | **no!** | **no!** | H264, H265, AAC, FLAC* | | macOS [Hass App][1] | no | no | no | H264, H265, AAC, FLAC* | [1]: https://apps.apple.com/app/home-assistant/id1099568401 diff --git a/pkg/mp4/helpers.go b/pkg/mp4/helpers.go index 34bd394d..fc2a9cf9 100644 --- a/pkg/mp4/helpers.go +++ b/pkg/mp4/helpers.go @@ -55,7 +55,6 @@ func ParseCodecs(codecs string, parseAudio bool) (medias []*core.Media) { var videos []*core.Codec var audios []*core.Codec -loop: for _, name := range strings.Split(codecs, ",") { switch name { case MimeH264: @@ -67,10 +66,6 @@ loop: case MimeAAC: codec := &core.Codec{Name: core.CodecAAC} audios = append(audios, codec) - case "null": - // this means that the browser is lying about the codecs it can play - // and we are not supposed to believe that it can flac or opus - break loop case MimeFlac: audios = append(audios, &core.Codec{Name: core.CodecPCMA}, diff --git a/www/video-rtc.js b/www/video-rtc.js index 5f6b778d..dfb4228a 100644 --- a/www/video-rtc.js +++ b/www/video-rtc.js @@ -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) {