-
Notifications
You must be signed in to change notification settings - Fork 17
/
RecorderEndpoint.go
48 lines (35 loc) · 1.1 KB
/
RecorderEndpoint.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package kurento
import "fmt"
type IRecorderEndpoint interface {
Record() error
}
// Provides function to store contents in reliable mode (doesn't discard data). It
// contains `MediaSink` pads for audio and video.
type RecorderEndpoint struct {
UriEndpoint
}
// Return contructor params to be called by "Create".
func (elem *RecorderEndpoint) getConstructorParams(from IMediaObject, options map[string]interface{}) map[string]interface{} {
// Create basic constructor params
ret := map[string]interface{}{
"mediaPipeline": fmt.Sprintf("%s", from),
"uri": "",
"mediaProfile": fmt.Sprintf("%s", from),
"stopOnEndOfStream": fmt.Sprintf("%s", from),
}
// then merge options
mergeOptions(ret, options)
return ret
}
// Starts storing media received through the `MediaSink` pad
func (elem *RecorderEndpoint) Record() error {
req := elem.getInvokeRequest()
req["params"] = map[string]interface{}{
"operation": "record",
"object": elem.Id,
}
// Call server and wait response
response := <-elem.connection.Request(req)
// Returns error or nil
return response.Error
}