feat(platform): wire DisplayCaptureFeed and ingestDisplayCapture

Attach display capture feed to ScreenShareHub, reset on voice leave/stop
share, and accept base64 JPEG frames from the Pear UI for P2P screen share.
This commit is contained in:
Raven Scott
2026-05-21 22:22:17 -04:00
parent 0ec5bbfe56
commit 881fbfae4b
2 changed files with 14 additions and 1 deletions
+13 -1
View File
@@ -26,6 +26,7 @@ const { PearcordForum } = require('pearcord-forum')
const { PearcordStage, STAGE_ROLE, isStageChannel } = require('pearcord-stage')
const { PearcordAutomod } = require('pearcord-automod')
const { ScreenShareHub } = require('pearcord-screen-share')
const { DisplayCaptureFeed } = require('pearcord-display-capture')
const {
PearcordAnnouncements,
formatCrosspostBody
@@ -86,6 +87,7 @@ class PearcordPlatform extends EventEmitter {
this.voiceMedia = null
this.voiceCapture = null
this.screenShare = null
this.displayCapture = null
this.announcements = null
this.boosts = null
this.slashCommands = null
@@ -339,6 +341,7 @@ class PearcordPlatform extends EventEmitter {
}
}
const payload = await this.voice.leave()
this.displayCapture?.reset()
if (this.screenShare?.active) {
const screenStop = await this.screenShare.stopShare()
if (gossip && screenStop && this.guild) {
@@ -1224,10 +1227,12 @@ class PearcordPlatform extends EventEmitter {
this.voiceMedia.on('audio-frame', (frame) => {
this.guild?.sendVoiceMedia?.(frame)
})
this.displayCapture = new DisplayCaptureFeed()
this.screenShare = new ScreenShareHub({
storagePath: this.storagePath,
guildId,
userId: user.id
userId: user.id,
displayFeed: this.displayCapture
})
await this.screenShare.ready()
this.guild?.setScreenShareHub(this.screenShare)
@@ -1260,9 +1265,15 @@ class PearcordPlatform extends EventEmitter {
return row
}
ingestDisplayCapture (payload) {
if (!this.displayCapture || !this.screenShare?.active) return false
return this.displayCapture.push(payload || {})
}
async stopScreenShare () {
if (!this.screenShare?.active) return null
const row = await this.screenShare.stopShare()
this.displayCapture?.reset()
if (row && this.guild) {
this.guild.gossipScreenShare(row)
this.guild.sendScreenMedia({
@@ -3317,6 +3328,7 @@ class PearcordPlatform extends EventEmitter {
this.voiceMedia = null
this.voiceCapture = null
this.screenShare = null
this.displayCapture = null
this.announcements = null
this.boosts = null
this.removeAllListeners()
+1
View File
@@ -38,6 +38,7 @@
"pearcord-stage": "file:../pearcord-stage",
"pearcord-automod": "file:../pearcord-automod",
"pearcord-screen-share": "file:../pearcord-screen-share",
"pearcord-display-capture": "git+https://git.ssh.surf/pearcord/pearcord-display-capture.git#main",
"pearcord-announcements": "file:../pearcord-announcements",
"pearcord-boosts": "file:../pearcord-boosts",
"pearcord-voice-capture": "file:../pearcord-voice-capture",