diff options
-rw-r--r-- | src/constants.js | 6 | ||||
-rw-r--r-- | src/utils/signaling.js | 3 | ||||
-rw-r--r-- | src/utils/webrtc/webrtc.js | 14 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/constants.js b/src/constants.js index e5a5cfb09..a3d3c0a98 100644 --- a/src/constants.js +++ b/src/constants.js @@ -49,6 +49,12 @@ export const PARTICIPANT = { WITH_VIDEO: 4, WITH_PHONE: 8, }, + SIP_FLAG: { + MUTE_MICROPHONE: 1, + MUTE_SPEAKER: 2, + SPEAKING: 4, + RAISE_HAND: 8, + }, NOTIFY: { DEFAULT: 0, ALWAYS: 1, diff --git a/src/utils/signaling.js b/src/utils/signaling.js index 1b0af2b75..6042e98de 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -1147,6 +1147,9 @@ Signaling.Standalone.prototype.processRoomParticipantsEvent = function(data) { this._trigger('usersChanged', [data.event.update.users || []]) this._trigger('participantListChanged') break + case 'flags': + this._trigger('participantFlagsChanged', [data.event.flags || []]) + break default: console.error('Unknown room participant event', data) break diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index 0535e1500..a0c290d8a 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -394,6 +394,20 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local }) usersInCallChanged(signaling, usersInCallMapping) }) + signaling.on('participantFlagsChanged', function(event) { + /** + * event { + * roomid: "1609407087", + * sessionid: "…", + * flags: 1 + * } + */ + const callParticipantModel = callParticipantCollection.get(event.sessionid) + if (callParticipantModel) { + callParticipantModel.set('speaking', (event.flags & PARTICIPANT.SIP_FLAG.SPEAKING) > 0) + callParticipantModel.set('audioAvailable', (event.flags & PARTICIPANT.SIP_FLAG.MUTE_MICROPHONE) === 0) + } + }) signaling.on('usersInRoom', function(users) { usersInCallMapping = {} users.forEach(function(user) { |