Fix HD720 and audio only playbacks (Hopefully this will fix it right?)
All checks were successful
CI / build (push) Successful in 3m52s

This commit is contained in:
Fijxu 2024-10-31 19:29:05 -03:00
parent fa0c7e9373
commit 78ae56be37
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -77,7 +77,6 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
log.Panic(err) log.Panic(err)
} }
w.WriteHeader(resp.StatusCode)
if resp.StatusCode == 403 { if resp.StatusCode == 403 {
atomic.AddInt64(&stats_.RequestsForbidden.Videoplayback, 1) atomic.AddInt64(&stats_.RequestsForbidden.Videoplayback, 1)
io.WriteString(w, "Forbidden 403\n") io.WriteString(w, "Forbidden 403\n")
@ -90,6 +89,8 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
NoRewrite := strings.HasPrefix(resp.Header.Get("Content-Type"), "audio") || strings.HasPrefix(resp.Header.Get("Content-Type"), "video") NoRewrite := strings.HasPrefix(resp.Header.Get("Content-Type"), "audio") || strings.HasPrefix(resp.Header.Get("Content-Type"), "video")
copyHeaders(resp.Header, w.Header(), NoRewrite) copyHeaders(resp.Header, w.Header(), NoRewrite)
w.WriteHeader(resp.StatusCode)
if req.Method == "GET" && (resp.Header.Get("Content-Type") == "application/x-mpegurl" || resp.Header.Get("Content-Type") == "application/vnd.apple.mpegurl") { if req.Method == "GET" && (resp.Header.Get("Content-Type") == "application/x-mpegurl" || resp.Header.Get("Content-Type") == "application/vnd.apple.mpegurl") {
bytes, err := io.ReadAll(resp.Body) bytes, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {