From c5035f721cb7a8d629762fa811e504d191ad1063 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Wed, 25 Jan 2023 12:38:54 +0100 Subject: [PATCH] added stop push and fix body interface{} --- ovenmedia/ovenmedia.go | 4 +++- ovenmedia/push.go | 14 +++++++++++++- ovenmedia/recording.go | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 ovenmedia/recording.go diff --git a/ovenmedia/ovenmedia.go b/ovenmedia/ovenmedia.go index d9d7371..40580fd 100644 --- a/ovenmedia/ovenmedia.go +++ b/ovenmedia/ovenmedia.go @@ -20,7 +20,9 @@ type IOvenMediaClient interface { CreateVirtualHost(name string) (*ResponseVirtualHost, error) GetAllVirtualHosts() (*ResponseVirtualList, error) // Push - StartPush(vHost string, appName string) (*resty.Response, error) + StartPush(vHost string, appName string, body interface{}) (*resty.Response, error) + StopPush(vHost string, appName string, body interface{}) (*resty.Response, error) + // Recording } func (o *OvenMedia) HealthCheck() error { diff --git a/ovenmedia/push.go b/ovenmedia/push.go index 896e583..bced7eb 100644 --- a/ovenmedia/push.go +++ b/ovenmedia/push.go @@ -7,8 +7,9 @@ import ( ) // POST http://1.2.3.4:8081/v1/vhosts/default/apps/app:startPush -func (o *OvenMedia) StartPush(vHost string, appName string) (*resty.Response, error) { +func (o *OvenMedia) StartPush(vHost string, appName string, body interface{}) (*resty.Response, error) { // + // resp, err := o.RestyPost(GET_VHOSTS_PUSH_BY_NAME(vHost, appName), nil) if err != nil { return nil, err @@ -16,3 +17,14 @@ func (o *OvenMedia) StartPush(vHost string, appName string) (*resty.Response, er fmt.Println("resp", resp) return resp, nil } + + +func (o *OvenMedia) StopPush(vHost string, appName string,body interface{}) (*resty.Response, error) + // + resp, err := o.RestyPost(V1_HOSTS_STOP_PUSH_NAME(vHost, appName), body) + if err != nil { + return nil, err + } + fmt.Println("resp", resp) + return resp, nil +} diff --git a/ovenmedia/recording.go b/ovenmedia/recording.go new file mode 100644 index 0000000..29f7c2a --- /dev/null +++ b/ovenmedia/recording.go @@ -0,0 +1,16 @@ +package ovenmedia + +/* +{ + "id": "custom_id", + "stream": { + "name": "stream_o", + "tracks": [ 100, 200 ] + }, + "filePath" : "/path/to/save/recorded/file_${Sequence}.ts", + "infoPath" : "/path/to/save/information/file.xml", + "interval" : 60000, # Split it every 60 seconds + "schedule" : "0 0 1" # Split it at second 0, minute 0, every hours. + "segmentationRule" : "continuity" + +}*/