[mirotalksfu] - #22 add real-time polls

هذا الالتزام موجود في:
Miroslav Pejic
2024-07-18 08:50:57 +02:00
الأصل 55c7da49cd
التزام e5785538ef
11 ملفات معدلة مع 589 إضافات و6 حذوفات

عرض الملف

@@ -61,6 +61,9 @@ module.exports = class Room {
this.rtmpFileStreamer = null;
this.rtmpUrlStreamer = null;
this.rtmp = config.server.rtmp || false;
// Polls
this.polls = [];
}
// ####################################################
@@ -87,10 +90,30 @@ module.exports = class Room {
survey: this.survey,
redirect: this.redirect,
videoAIEnabled: this.videoAIEnabled,
thereIsPolls: this.thereIsPolls(),
peers: JSON.stringify([...this.peers]),
};
}
// ##############################################
// POLLS
// ##############################################
thereIsPolls() {
return this.polls.length > 0;
}
getPolls() {
return this.polls;
}
convertPolls(polls) {
return polls.map((poll) => {
const voters = poll.voters ? Object.fromEntries(poll.voters.entries()) : {};
return { ...poll, voters };
});
}
// ##############################################
// RTMP from FILE
// ##############################################