forked from External/mediamtx
import changes
This commit is contained in:
parent
da5420a788
commit
09ad8e7160
3 changed files with 28 additions and 0 deletions
|
|
@ -180,6 +180,10 @@ type Path struct {
|
|||
RunOnUnread string `json:"runOnUnread"`
|
||||
RunOnRecordSegmentCreate string `json:"runOnRecordSegmentCreate"`
|
||||
RunOnRecordSegmentComplete string `json:"runOnRecordSegmentComplete"`
|
||||
|
||||
// Custom hooks
|
||||
HTTPOnReady string `json:"httpOnReady"`
|
||||
HTTPOnNotReady string `json:"httpOnNotReady"`
|
||||
}
|
||||
|
||||
func (pconf *Path) setDefaults() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package hooks
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/defs"
|
||||
"github.com/bluenviron/mediamtx/internal/externalcmd"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OnReadyParams are the parameters of OnReady.
|
||||
|
|
@ -41,6 +44,16 @@ func OnReady(params OnReadyParams) func() {
|
|||
})
|
||||
}
|
||||
|
||||
if params.Conf.HTTPOnReady != "" {
|
||||
obj := map[string]any{
|
||||
"query": params.Query,
|
||||
"desc": params.Desc,
|
||||
"env": params.ExternalCmdEnv,
|
||||
}
|
||||
jsonValue, _ := json.Marshal(obj)
|
||||
http.Post(params.Conf.HTTPOnReady, "application/json", bytes.NewBuffer(jsonValue))
|
||||
}
|
||||
|
||||
return func() {
|
||||
if onReadyCmd != nil {
|
||||
onReadyCmd.Close()
|
||||
|
|
@ -56,5 +69,15 @@ func OnReady(params OnReadyParams) func() {
|
|||
env,
|
||||
nil)
|
||||
}
|
||||
if params.Conf.HTTPOnNotReady != "" {
|
||||
obj := map[string]any{
|
||||
"query": params.Query,
|
||||
"desc": params.Desc,
|
||||
"env": params.ExternalCmdEnv,
|
||||
}
|
||||
jsonValue, _ := json.Marshal(obj)
|
||||
http.Post(params.Conf.HTTPOnNotReady, "application/json", bytes.NewBuffer(jsonValue))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,6 +437,7 @@ const sendOffer = (offer) => {
|
|||
return res.text()
|
||||
.then((sdp) => onRemoteAnswer(sdp));
|
||||
})
|
||||
.then((sdp) => onRemoteAnswer(sdp))
|
||||
.catch((err) => {
|
||||
onError(err.toString());
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue