Skip to content

Commit

Permalink
fix: mkv videos not playing on browser
Browse files Browse the repository at this point in the history
  • Loading branch information
jabuxas committed Sep 19, 2024
1 parent e341d2f commit 9d5fbca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ func (app *Application) indexHandler(w http.ResponseWriter, r *http.Request) {
".rst": true,
}

videoExtensions := map[string]bool{
".mkv": true,
}

if textExtensions[ext] {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
}

if videoExtensions[ext] {
w.Header().Set("Content-Type", "video/mp4")
}

http.ServeFile(w, r, path)
return
}
Expand Down

0 comments on commit 9d5fbca

Please sign in to comment.