Fix FLAC mime type for HLS

This commit is contained in:
Alexey Khit
2023-07-13 16:14:50 +03:00
parent b9b7bb5489
commit c81e29fe54
3 changed files with 3 additions and 11 deletions
+1 -5
View File
@@ -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 {
+1 -5
View File
@@ -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})
+1 -1
View File
@@ -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"
)