Skip to content

Commit

Permalink
feat: guest in scene feedback / variable (#30)
Browse files Browse the repository at this point in the history
* feat: add guest in scene feedback

* feat: add variable for scenes guest is in

* chore: version up

* chore: update dependencies

* change format to allow for named scenes

* chore: format
  • Loading branch information
bryce-seifert authored Dec 23, 2024
1 parent 3aff4f2 commit 4d90bab
Show file tree
Hide file tree
Showing 8 changed files with 577 additions and 1,396 deletions.
1 change: 0 additions & 1 deletion .github/workflows/companion-module-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ jobs:
uses: bitfocus/actions/.github/workflows/module-checks.yaml@main
# with:
# upload-artifact: true # uncomment this to upload the built package as an artifact to this workflow that you can download and share with others

2 changes: 1 addition & 1 deletion actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export function getActions() {
this.sendRequest(
'bitrate',
null,
action.options.value === 'custom' ? action.options.bitrate : action.options.value
action.options.value === 'custom' ? action.options.bitrate : action.options.value,
)
},
},
Expand Down
2 changes: 2 additions & 0 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ Control [VDO.Ninja](https://vdo.ninja) settings remotely.
- Mic Status
- Camera Status
- Speaker Status
- Guest in Scene

### Available Variables

- mic (Current mute status, either by stream ID or guest position)
- camera (Current camera status, either by stream ID or guest position)
- speaker (Available for the "Director" role only)
- label (If specified, otherwise it will be the guest position number)
- scenes (List of scenes a guest is currently active in)
2 changes: 1 addition & 1 deletion companion/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "vdo-ninja",
"shortname": "VDO.Ninja",
"description": "vdo-ninja",
"version": "2.2.2",
"version": "0.0.0",
"license": "MIT",
"repository": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git",
"bugs": "https://github.com/bitfocus/companion-module-vdo-ninja/issues",
Expand Down
34 changes: 34 additions & 0 deletions feedbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,40 @@ export function getFeedbacks() {
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
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{
"name": "vdo-ninja",
"version": "2.2.2",
"version": "2.3.0",
"main": "index.js",
"type": "module",
"scripts": {
"format": "prettier -w ."
},
"license": "MIT",
"dependencies": {
"@companion-module/base": "~1.8.0",
"ws": "^8.17.1"
"@companion-module/base": "~1.11.2",
"ws": "^8.18.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git"
},
"devDependencies": {
"@companion-module/tools": "^1.5.1"
"@companion-module/tools": "^2.1.1",
"prettier": "^3.4.2"
},
"prettier": "@companion-module/tools/.prettierrc.json"
}
13 changes: 13 additions & 0 deletions variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export function getVariables() {
variables.push({ variableId: `guest_${data.position}_mic`, name: `Guest ${data.position} ${name} - Mic` })
variables.push({ variableId: `guest_${data.position}_camera`, name: `Guest ${data.position} ${name} - Camera` })
variables.push({ variableId: `guest_${data.position}_label`, name: `Guest ${data.position} - Label` })
variables.push({ variableId: `guest_${data.position}_scenes`, name: `Guest ${data.position} - Scenes` })
}
variables.push({ variableId: `${data.streamID}_mic`, name: `Stream ID: ${data.streamID} - Mic` })
variables.push({ variableId: `${data.streamID}_camera`, name: `Stream ID: ${data.streamID} - Camera` })
variables.push({ variableId: `${data.streamID}_label`, name: `Stream ID: ${data.streamID} - Label` })
variables.push({ variableId: `${data.streamID}_scenes`, name: `Stream ID: ${data.streamID} - Scenes` })
}
}
return variables
Expand All @@ -27,6 +29,15 @@ export function updateVariables() {
for (let x in this.states) {
let data = this.states[x]
let label = data.label ? data.label : `Guest ${data.position}`
let sceneList = []

if (data.scenes) {
for (let scene in data.scenes) {
if (data.scenes[scene] === true) {
sceneList.push(scene)
}
}
}

if (data.streamID) {
if (data.director) {
Expand All @@ -41,12 +52,14 @@ export function updateVariables() {
[`guest_${data.position}_mic`]: data.muted || data.others?.['mute-guest'] == 1 ? 'Muted' : 'Unmuted',
[`guest_${data.position}_camera`]: data.videoMuted || data.others?.['hide-guest'] == 1 ? 'Muted' : 'Unmuted',
[`guest_${data.position}_label`]: label,
[`guest_${data.position}_scenes`]: sceneList?.length ? sceneList : 'None',
})
}
this.setVariableValues({
[`${data.streamID}_mic`]: data.muted || data.others?.['mute-guest'] == 1 ? 'Muted' : 'Unmuted',
[`${data.streamID}_camera`]: data.videoMuted || data.others?.['hide-guest'] == 1 ? 'Muted' : 'Unmuted',
[`${data.streamID}_label`]: label,
[`${data.streamID}_scenes`]: sceneList?.length ? sceneList : 'None',
})
}
}
Expand Down
Loading

0 comments on commit 4d90bab

Please sign in to comment.