title: GoLang - Seeking through a video (serving as bytes)
body: <p>I'm writing a server in golang and I got it to serve a basic .mp4 file. It serves it by bytes. The problem is that I can not seek/skip through the video. I've tried searching throughout stackover flow and google to find an answer but I came up short..</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package main
  
  import (
      "net/http"
      "io/ioutil"
      "fmt"
      "os"
      "log"
      "bytes"
  )
  
  func ServeHTTP(w http.ResponseWriter, r *http.Request) {
             // grab the generated receipt.pdf file and stream it to browser
             streamPDFbytes, err := ioutil.ReadFile("./video.mp4")
             log.Println(r)
             if err != nil {
                     fmt.Println(err)
                     os.Exit(1)
             }
  
             b := bytes.NewBuffer(streamPDFbytes)
  
             // stream straight to client(browser)
             w.Header().Set("Content-type", "video/mp4")
  
             if _, err := b.WriteTo(w); err != nil { // &lt;----- here!
                     fmt.Fprintf(w, "%s", err)
             }
  
             w.Write([]byte("Video Completed"))
  }
  
  func main() {
      http.Handle("/", new(MyHandler))
      http.ListenAndServe(":8080", nil)
  }
  </code></pre>
  
  <p>Does anyone have the answer to how seeking works in golang? </p>
  
  <p>Thanks,
  Have a great day!</p>