From 78ae56be37af2257364703bb6cb4f5ad6c11b5e1 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Thu, 31 Oct 2024 19:29:05 -0300 Subject: [PATCH] Fix HD720 and audio only playbacks (Hopefully this will fix it right?) --- httppaths.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httppaths.go b/httppaths.go index 153eaa3..003ab34 100644 --- a/httppaths.go +++ b/httppaths.go @@ -77,7 +77,6 @@ func videoplayback(w http.ResponseWriter, req *http.Request) { log.Panic(err) } - w.WriteHeader(resp.StatusCode) if resp.StatusCode == 403 { atomic.AddInt64(&stats_.RequestsForbidden.Videoplayback, 1) 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") 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") { bytes, err := io.ReadAll(resp.Body) if err != nil {