generated from bitfocus/companion-module-template-js
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathactions.js
152 lines (151 loc) · 3.07 KB
/
actions.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
export function getActions() {
let actions = {
startLiveEvent: {
name: 'Start Live Event',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
],
callback: (action) => {
let start = { start: '' }
this.sendPostRequest(`live_events/${action.options.id}/start`, start)
},
},
stopLiveEvent: {
name: 'Stop Live Event',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
],
callback: (action) => {
let stop = { stop: '' }
this.sendPostRequest(`live_events/${action.options.id}/stop`, stop)
},
},
cancelLiveEvent: {
name: 'Cancel Live Event',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
],
callback: (action) => {
let cancel = { cancel: '' }
this.sendPostRequest(`live_events/${action.options.id}/cancel`, cancel)
},
},
archiveLiveEvent: {
name: 'Archive Live Event',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
],
callback: (action) => {
let archive = { archive: '' }
this.sendPostRequest(`live_events/${action.options.id}/archive`, archive)
},
},
resetLiveEvent: {
name: 'Reset Live Event',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
],
callback: (action) => {
let reset = { reset: '' }
this.sendPostRequest(`live_events/${action.options.id}/reset`, reset)
},
},
muteAudio: {
name: 'Mute/Unmute Audio',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
{
id: 'mute',
type: 'checkbox',
label: 'Mute',
default: true,
},
],
callback: (action) => {
if (action.options.mute) {
let mute = { mute_audio: '' }
this.sendPostRequest(`live_events/${action.options.id}/mute_audio`, mute)
} else {
let unmute = { unmute_audio: '' }
this.sendPostRequest(`live_events/${action.options.id}/unmute_audio`, unmute)
}
},
},
setAudioGain: {
name: 'Set Audio Gain',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
{
id: 'gain',
type: 'number',
label: 'Gain (dB)',
default: 0,
min: -60,
max: 60,
range: true,
},
],
callback: (action) => {
let audioGain = { gain: action.options.gain }
this.sendPostRequest(`live_events/${action.options.id}/adjust_audio_gain`, audioGain)
},
},
insertSCTE35Message: {
name: 'Insert SCTE35',
options: [
{
id: 'id',
type: 'textinput',
label: 'Event ID',
default: '',
},
{
id: 'duration',
type: 'number',
label: 'Duration',
default: '',
},
],
callback: (action) => {
let spliceMessage = { cue_point: { duration: action.options.duration, splice_offset: 0 } }
this.sendPostRequest(`live_events/${action.options.id}/cue_point`, spliceMessage)
},
},
}
return actions
}