mirror of
https://github.com/owncast/owncast.git
synced 2025-11-03 13:01:46 +08:00
Force the content type on hls playlists
This commit is contained in:
@ -38,6 +38,9 @@ func HandleHLSRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Playlists should never be cached.
|
// Playlists should never be cached.
|
||||||
middleware.DisableCache(w)
|
middleware.DisableCache(w)
|
||||||
|
|
||||||
|
// Force the correct content type
|
||||||
|
w.Header().Set("Content-Type", "application/x-mpegURL")
|
||||||
|
|
||||||
// Use this as an opportunity to mark this viewer as active.
|
// Use this as an opportunity to mark this viewer as active.
|
||||||
id := utils.GenerateClientIDFromRequest(r)
|
id := utils.GenerateClientIDFromRequest(r)
|
||||||
core.SetViewerIDActive(id)
|
core.SetViewerIDActive(id)
|
||||||
@ -45,6 +48,7 @@ func HandleHLSRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
cacheTime := utils.GetCacheDurationSecondsForPath(relativePath)
|
cacheTime := utils.GetCacheDurationSecondsForPath(relativePath)
|
||||||
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(cacheTime))
|
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(cacheTime))
|
||||||
}
|
}
|
||||||
|
|
||||||
middleware.EnableCors(w)
|
middleware.EnableCors(w)
|
||||||
http.ServeFile(w, r, fullPath)
|
http.ServeFile(w, r, fullPath)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user