Take control over your live stream video by running it yourself. Streaming + chat out of the box.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
703 B

package controllers
import (
"net/http"
"path/filepath"
"github.com/owncast/owncast/router/middleware"
"github.com/owncast/owncast/utils"
)
// IndexHandler handles the default index route.
func IndexHandler(w http.ResponseWriter, r *http.Request) {
middleware.EnableCors(w)
isIndexRequest := r.URL.Path == "/" || filepath.Base(r.URL.Path) == "index.html" || filepath.Base(r.URL.Path) == ""
if utils.IsUserAgentAPlayer(r.UserAgent()) && isIndexRequest {
http.Redirect(w, r, "/hls/stream.m3u8", http.StatusTemporaryRedirect)
return
}
// Set a cache control max-age header
middleware.SetCachingHeaders(w, r)
// Set our global HTTP headers
middleware.SetHeaders(w)
serveWeb(w, r)
}