diff --git a/internal/hls/hls.go b/internal/hls/hls.go index a1b7e81d..2565d282 100644 --- a/internal/hls/hls.go +++ b/internal/hls/hls.go @@ -11,7 +11,6 @@ import ( "github.com/AlexxIT/go2rtc/pkg/tcp" "github.com/rs/zerolog" "net/http" - "strings" "sync" "time" ) @@ -138,12 +137,9 @@ segment.ts?id=` + sid + `&n=%d` sessions[sid] = session sessionsMu.Unlock() - // Apple Safari can play FLAC codec, but fail it it in m3u8 playlist - codecs := strings.Replace(cons.MimeCodecs(), mp4.MimeFlac, mp4.MimeAAC, 1) - // bandwidth important for Safari, codecs useful for smooth playback data := []byte(`#EXTM3U -#EXT-X-STREAM-INF:BANDWIDTH=1000000,CODECS="` + codecs + `" +#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="` + cons.MimeCodecs() + `" hls/playlist.m3u8?id=` + sid) if _, err := w.Write(data); err != nil { diff --git a/internal/hls/ws.go b/internal/hls/ws.go index 861c948a..96c6eb64 100644 --- a/internal/hls/ws.go +++ b/internal/hls/ws.go @@ -8,7 +8,6 @@ import ( "github.com/AlexxIT/go2rtc/pkg/core" "github.com/AlexxIT/go2rtc/pkg/mp4" "github.com/AlexxIT/go2rtc/pkg/tcp" - "strings" "time" ) @@ -69,12 +68,9 @@ segment.m4s?id=` + sid + `&n=%d` sessions[sid] = session sessionsMu.Unlock() - // Apple Safari can play FLAC codec, but fail it it in m3u8 playlist - codecs = strings.Replace(cons.MimeCodecs(), mp4.MimeFlac, mp4.MimeAAC, 1) - // bandwidth important for Safari, codecs useful for smooth playback data := `#EXTM3U -#EXT-X-STREAM-INF:BANDWIDTH=1000000,CODECS="` + codecs + `" +#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="` + cons.MimeCodecs() + `" hls/playlist.m3u8?id=` + sid tr.Write(&ws.Message{Type: "hls", Value: data}) diff --git a/pkg/mp4/muxer.go b/pkg/mp4/muxer.go index 3e9d1d4e..96b8a372 100644 --- a/pkg/mp4/muxer.go +++ b/pkg/mp4/muxer.go @@ -22,7 +22,7 @@ const ( MimeH264 = "avc1.640029" MimeH265 = "hvc1.1.6.L153.B0" MimeAAC = "mp4a.40.2" - MimeFlac = "flac" + MimeFlac = "fLaC" // case is important for Apple HLS MimeOpus = "opus" )