Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/standalone-signaling-api-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ Message format (Server -> Client, participants change):

If a participant has the `inCall` flag set, he has joined the call of the room
and a WebRTC peerconnection should be established if the local client is also
in the call.
in the call. In that case the participant information will contain properties
for both the signaling session id (`sessionId`) and the Nextcloud session id
(`nextcloudSessionId`).


## Room messages
Expand Down
1 change: 1 addition & 0 deletions lib/Signaling/BackendNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ public function roomInCallChanged(Room $room, int $flags, array $sessionIds): vo
$data['inCall'] = $session->getInCall();
$data['lastPing'] = $session->getLastPing();
$data['sessionId'] = $session->getSessionId();
$data['nextcloudSessionId'] = $session->getSessionId();

if ($session->getInCall() !== Participant::FLAG_DISCONNECTED) {
$users[] = $data;
Expand Down
16 changes: 12 additions & 4 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,13 @@ export default {
},
mounted() {
EventBus.$on('refreshPeerList', this.debounceFetchPeers)

callParticipantCollection.on('remove', this._lowerHandWhenParticipantLeaves)
},
beforeDestroy() {
EventBus.$off('refreshPeerList', this.debounceFetchPeers)

callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves)
},
methods: {
/**
Expand Down Expand Up @@ -410,8 +414,6 @@ export default {
this.raisedHandUnwatchers[removedModelId]()
// Not reactive, but not a problem
delete this.raisedHandUnwatchers[removedModelId]
// FIXME: when using HPB sessionId doesn't match
this.$store.dispatch('setParticipantHandRaised', { sessionId: removedModelId, raisedHand: { state: false } })

const index = this.speakers.findIndex(speaker => speaker.id === removedModelId)
this.speakers.splice(index, 1)
Expand Down Expand Up @@ -501,12 +503,18 @@ export default {

// update in callViewStore
this.$store.dispatch('setParticipantHandRaised', {
// FIXME: this is a bit hacky to fix the HPB session mismatch
sessionId: raisedHand?.sessionId ? raisedHand?.sessionId : callParticipantModel.attributes.peerId,
sessionId: callParticipantModel.attributes.nextcloudSessionId,
raisedHand: raisedHand,
})
},

_lowerHandWhenParticipantLeaves(callParticipantCollection, callParticipantModel) {
this.$store.dispatch('setParticipantHandRaised', {
sessionId: callParticipantModel.attributes.nextcloudSessionId,
raisedHand: false,
})
},

_setScreenAvailable(id, screen) {
if (screen) {
this.screens.unshift(id)
Expand Down
3 changes: 1 addition & 2 deletions src/components/CallView/shared/LocalMediaControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,7 @@ export default {
this.$store.dispatch(
'setParticipantHandRaised',
{
// FIXME: when using HPB these don't match
sessionId: this.localCallParticipantModel.attributes.peerId,
sessionId: this.$store.getters.getSessionId(),
raisedHand: this.model.attributes.raisedHand,
}
)
Expand Down
5 changes: 5 additions & 0 deletions src/utils/webrtc/models/CallParticipantModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function CallParticipantModel(options) {

this.attributes = {
peerId: null,
nextcloudSessionId: null,
peer: null,
screenPeer: null,
// "undefined" is used for values not known yet; "null" or "false"
Expand Down Expand Up @@ -348,4 +349,8 @@ CallParticipantModel.prototype = {
this.set('userId', userId)
},

setNextcloudSessionId: function(nextcloudSessionId) {
this.set('nextcloudSessionId', nextcloudSessionId)
},

}
1 change: 0 additions & 1 deletion src/utils/webrtc/models/LocalMediaModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ LocalMediaModel.prototype = {
const raisedHand = {
state: raised,
timestamp: Date.now(),
sessionId: this._webRtc.connection?.nextcloudSessionId,
}

this._webRtc.sendToAll('raiseHand', raisedHand)
Expand Down
7 changes: 7 additions & 0 deletions src/utils/webrtc/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
// TODO(fancycode): Adjust property name of internal PHP backend to be all lowercase.
const userId = user.userId || user.userid || null

// When the external signaling server is used the Nextcloud session id
// will be provided in its own property. When the internal signaling
// server is used the Nextcloud session id and the signaling session id
// are the same and thus set from the signaling session id.
const nextcloudSessionId = user.nextcloudSessionId || user.nextcloudsessionid || sessionId

let callParticipantModel = callParticipantCollection.get(sessionId)
if (!callParticipantModel) {
callParticipantModel = callParticipantCollection.add({
Expand All @@ -237,6 +243,7 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
})
}
callParticipantModel.setUserId(userId)
callParticipantModel.setNextcloudSessionId(nextcloudSessionId)
if (user.internal) {
callParticipantModel.set('internal', true)
}
Expand Down
7 changes: 7 additions & 0 deletions tests/php/Signaling/BackendNotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ public function testRoomInCallChanged() {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
Expand All @@ -522,6 +523,7 @@ public function testRoomInCallChanged() {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
Expand All @@ -545,6 +547,7 @@ public function testRoomInCallChanged() {
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],
Expand All @@ -553,13 +556,15 @@ public function testRoomInCallChanged() {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
[
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],
Expand All @@ -578,6 +583,7 @@ public function testRoomInCallChanged() {
'inCall' => 0,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
Expand All @@ -587,6 +593,7 @@ public function testRoomInCallChanged() {
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],
Expand Down