Skip to content

Commit

Permalink
feat(new): [TP-1] Adding in states for camera and screenshare
Browse files Browse the repository at this point in the history
  • Loading branch information
spdermn02 committed Mar 3, 2024
1 parent 8dd1974 commit d46cdbd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
22 changes: 22 additions & 0 deletions base/entry.tp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,28 @@
"On"
]
},
{
"id": "discord_camera_status",
"type":"choice",
"desc":" Discord Camera",
"default": "Off",
"valueChoices": [
"Off",
"On"
]

},
{
"id": "discord_screenshare_status",
"type":"choice",
"desc":" Discord Screen Share",
"default": "Off",
"valueChoices": [
"Off",
"On"
]

},
{
"id": "discord_voice_channel_connected",
"type": "choice",
Expand Down
2 changes: 1 addition & 1 deletion discord-rpc
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ const connectToDiscord = function () {
await DiscordClient.subscribe("CHANNEL_CREATE").catch((err) => {logIt("ERROR",err)});
await DiscordClient.subscribe("VOICE_CHANNEL_SELECT").catch((err) => {logIt("ERROR",err)});
await DiscordClient.subscribe("VOICE_CONNECTION_STATUS").catch((err) => {logIt("ERROR",err)});
await DiscordClient.subscribe("VIDEO_STATE_UPDATE").catch((err) => {logIt("ERROR",err)});
await DiscordClient.subscribe("SCREENSHARE_STATE_UPDATE").catch((err) => {logIt("ERROR",err)});

DiscordClient.on("VOICE_STATE_CREATE", (data) => {voiceState('create',data);})
DiscordClient.on("VOICE_STATE_UPDATE", (data) => {voiceState('update',data);})
Expand Down Expand Up @@ -716,6 +718,12 @@ const connectToDiscord = function () {
DiscordClient.on('VOICE_CONNECTION_STATUS', (data) => {
voiceConnectionStatus(data);
})
DiscordClient.on('VIDEO_STATE_UPDATE', (data) => {
TPClient.stateUpdate("discord_camera_status",data.active? "On" : "Off")
})
DiscordClient.on('SCREENSHARE_STATE_UPDATE', (data) => {
TPClient.stateUpdate("discord_screenshare_status",data.active? "On" : "Off")
})

DiscordClient.on("disconnected", () => {
logIt("WARN","discord connection closed, will attempt reconnect, once process detected");
Expand Down

0 comments on commit d46cdbd

Please sign in to comment.