http.ServeFile和http.ServeContent无法处理多个客户端

Scenario
I created a simple video streamer using golang. At First, I used http.ServeContent to serve my videos. It was working until I simultaneously connected 4 tabs to my server but the first two only works and the rest aren't loading at all. I can navigate to the menu while streaming the two videos but I can't stream on the rest. I also tried it using multiple devices. Only two connections can stream.

So, I changed http.ServeContent to http.ServeFile but its still the same but when I used io.Pipes, It served every request but the problem is that It can't seek.

Here is my code:

package main

import (
    "log"
    "net"
    "net/http"

    "github.com/gorilla/mux"
)

func serveVideo(w http.ResponseWriter, r *http.Request) {
    vars := mux.Vars(r)
    title := vars["title"]
    ep := vars["ep"]
    http.ServeFile(w, r, "video/" + title + "/" ep + ".mp4")
}

func main() {
     const port string = "8080"
    // Create mux router
    r := mux.NewRouter()
    r.HandleFunc("/video/{title}/{ep}", serveVideo)
    // let mux handle
    http.Handle("/", r)
    if err := http.ListenAndServe(":8080", nil); err != nil {
        log.Fatal(err)
    }
}

I wish you could help. Thank you.

I suspect your code is fine. All major browsers will normally limit the number of parallel active connections to a host.

As a simple test, try streaming multiple times with something like curl to confirm there is actually a problem with your code. Alternatively, try running different browsers simultaneously (e.g. 2 tabs in Chrome, 2 tabs in Firefox etc)