Rewrite FLV/RTMP clients

This commit is contained in:
Alexey Khit
2023-08-16 19:35:13 +03:00
parent 4e1a0e1ab9
commit c3ba8db660
9 changed files with 227 additions and 204 deletions

View File

@@ -23,9 +23,6 @@ func streamsHandle(url string) (core.Producer, error) {
if err != nil {
return nil, err
}
if err = client.Describe(); err != nil {
return nil, err
}
return client, nil
}
@@ -42,17 +39,12 @@ func apiHandle(w http.ResponseWriter, r *http.Request) {
return
}
client, err := flv.NewClient(r.Body)
client, err := flv.Open(r.Body)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if err = client.Describe(); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
stream.AddProducer(client)
if err = client.Start(); err != nil && err != io.EOF {