video - receive a ffmpeg live streaming with a golang server and echo to a websocket conn -


i'm writing server in go , need cam video in ffmpeg client , passes streaming websocket users.

but in code, http body received ffmpeg client loaded ioutil.readall , cannot make live broadcast because body receiving new values video capture. how can take last frame of video, send websockets, clean variable , receive new frame correctly (or i'm doing in wrong way)?

here code function:

//startclientstream needs email$clientname$streamname func startclientstream(w http.responsewriter, r *http.request) {      values := strings.split(string(mux.vars(r)["rest"]), "$")      if len(values) != 3 {         w.write([]byte(`{"err":"the passed value not match necessary fields"}`))         return     }     //get user id     id, _ := getid(values[0])     //take streaming clientname     clientname := id + " - " + values[1]     //take passed body     body, _ := ioutil.readall(r.body)     //watch websockets requests video     user := range streaming.user[clientname] {         conexoes := strings.split(streaming.user[clientname][user], "-")         c := range conexoes {             if strings.equalfold(conexoes[c], values[2]) {                 //send video                 user.send <- body             }         }     }  } 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -