generated from bitfocus/companion-module-template-js
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfeedbacks.js
More file actions
161 lines (157 loc) · 3.52 KB
/
feedbacks.js
File metadata and controls
161 lines (157 loc) · 3.52 KB
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
153
154
155
156
157
158
159
160
161
import { combineRgb } from '@companion-module/base'
export function getFeedbacks() {
const feedbacks = {}
const ColorWhite = combineRgb(255, 255, 255)
const ColorGreen = combineRgb(0, 200, 0)
feedbacks['mic'] = {
type: 'boolean',
name: 'Mic Status',
description: 'If mic matches the selected state, change the style of the button',
options: [
{
type: 'dropdown',
label: 'Stream',
id: 'stream',
allowCustom: true,
default: this.streams[0]?.id,
choices: this.streams,
},
{
type: 'dropdown',
label: 'Mic State',
id: 'state',
default: true,
choices: [
{ id: true, label: 'Muted' },
{ id: false, label: 'Unmuted' },
],
},
],
defaultStyle: {
color: ColorWhite,
bgcolor: ColorGreen,
},
callback: (feedback) => {
let stream = this.states[feedback.options.stream]
if (stream) {
if (stream.position && !stream.director) {
if (stream?.others?.['mute-guest'] == 1) {
return feedback.options.state ?? false
} else {
return stream?.muted === feedback.options.state
}
} else {
return stream?.muted === feedback.options.state
}
}
},
}
feedbacks['camera'] = {
type: 'boolean',
name: 'Camera Status',
description: 'If camera matches the selected state, change the style of the button',
options: [
{
type: 'dropdown',
label: 'Stream',
id: 'stream',
default: this.streams[0]?.id,
choices: this.streams,
},
{
type: 'dropdown',
label: 'Camera Status',
id: 'state',
default: true,
choices: [
{ id: true, label: 'Muted' },
{ id: false, label: 'Unmuted' },
],
},
],
defaultStyle: {
color: ColorWhite,
bgcolor: ColorGreen,
},
callback: (feedback) => {
let stream = this.states[feedback.options.stream]
if (stream) {
if (stream.position && !stream.director) {
if (stream?.others?.['hide-guest'] == 1) {
return feedback.options.state ?? false
} else {
return stream?.videoMuted === feedback.options.state
}
} else {
return stream?.videoMuted === feedback.options.state
}
}
},
}
feedbacks['speaker'] = {
type: 'boolean',
name: 'Speaker Status',
description: 'If speaker matches the selected state, change the style of the button',
options: [
{
type: 'dropdown',
label: 'Stream',
id: 'stream',
default: this.streams[0]?.id,
choices: this.streams,
},
{
type: 'dropdown',
label: 'Speaker Status',
id: 'state',
default: true,
choices: [
{ id: true, label: 'Muted' },
{ id: false, label: 'Unmuted' },
],
},
],
defaultStyle: {
color: ColorWhite,
bgcolor: ColorGreen,
},
callback: (feedback) => {
return this.states[feedback.options.stream]?.speakerMuted === feedback.options.state
},
}
feedbacks['guestScene'] = {
type: 'boolean',
name: 'Guest in Scene',
description: 'If a stream is active the selected scene, change the style of the button',
options: [
{
type: 'dropdown',
label: 'Stream',
id: 'stream',
allowCustom: true,
default: this.streams[0]?.id,
choices: this.streams,
},
{
type: 'textinput',
label: 'Scene name or ID (0 to 8)',
id: 'scene',
default: '1',
},
],
defaultStyle: {
color: ColorWhite,
bgcolor: ColorGreen,
},
callback: (feedback) => {
let stream = this.states[feedback.options.stream]
let scene = feedback.options.scene
if (stream) {
return stream?.scenes?.[scene] == true
} else {
return false
}
},
}
return feedbacks
}