Sfoglia il codice sorgente

Common: handle event when other participants leave

Vijayakrishnan 5 anni fa
parent
commit
a849336e5e
1 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. 18 0
      resources/views/meeting.blade.php

+ 18 - 0
resources/views/meeting.blade.php

@@ -265,6 +265,14 @@
 
                     // TODO: init pro stream
                 },
+                onParticipantLeft: function(_id) {
+                    this.pros = this.pros.filter(function(_row) {
+                        return _row.id !== _id;
+                    });
+                    this.guests = this.guests.filter(function(_row) {
+                        return _row.id !== _id;
+                    });
+                },
                 leaveCall: function() {
                     this.stompClient.send("/app/meeting-participant-leave-meeting", {},
                         JSON.stringify({
@@ -309,6 +317,11 @@
                             console.log("on-pro-join-meeting:", message);
                             self.onProJoined(JSON.parse(message.body));
                         });
+                        self.stompClient.subscribe("/topic/on-meeting-participant-left-meeting", function (message) {
+                            console.log("/topic/on-meeting-participant-left-meeting", message);
+                            var parsed = JSON.parse(message.body);
+                            self.onParticipantLeft(parsed.meetingParticipantUid);
+                        });
 
                         // join self
                         self.stompClient.send("/app/meeting-participant-join-meeting", {},
@@ -333,6 +346,11 @@
                             self.onProJoined(parsed);
                             self.participantID = parsed.meetingParticipantUid;
                         });
+                        self.stompClient.subscribe("/topic/on-meeting-participant-left-meeting", function (message) {
+                            console.log("/topic/on-meeting-participant-left-meeting", message);
+                            var parsed = JSON.parse(message.body);
+                            self.onParticipantLeft(parsed.meetingParticipantUid);
+                        });
 
                         // join self
                         self.stompClient.send("/app/pro-join-meeting", {},