Przeglądaj źródła

feat(recording): show the YouTube live stream URL (#736)

* feat(recording): show the YouTube live stream URL

- Pass you_tube_broadcast_id to Jibri so it can create a
  YouTube link for the live stream.
- Emit the liveStreamViewURL (the YouTube link) when it
  is received from the participant doing the recording.

* set member.liveStreamViewURL only when truthy
dev1
virtuacoplenny 7 lat temu
rodzic
commit
4f0b8fd39c

+ 13
- 0
JitsiConference.js Wyświetl plik

@@ -1264,6 +1264,19 @@ JitsiConference.prototype.onDisplayNameChanged = function(jid, displayName) {
1264 1264
         displayName);
1265 1265
 };
1266 1266
 
1267
+/**
1268
+ * Callback invoked when a known live stream URL has been updated.
1269
+ *
1270
+ * @params {*} ...args - Information regarding which participant has an updated
1271
+ * live stream URL and what that live stream URL is.
1272
+ * @returns {void}
1273
+ */
1274
+JitsiConference.prototype.onLiveStreamURLChange = function(...args) {
1275
+    this.eventEmitter.emit(
1276
+        JitsiConferenceEvents.LIVE_STREAM_URL_CHANGED,
1277
+        ...args);
1278
+};
1279
+
1267 1280
 /**
1268 1281
  * Notifies this JitsiConference that a JitsiRemoteTrack was added into
1269 1282
  * the conference.

+ 3
- 0
JitsiConferenceEventManager.js Wyświetl plik

@@ -266,6 +266,9 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
266 266
     chatRoom.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
267 267
         conference.onDisplayNameChanged.bind(conference));
268 268
 
269
+    chatRoom.addListener(XMPPEvents.LIVE_STREAM_URL_CHANGE,
270
+        conference.onLiveStreamURLChange.bind(conference));
271
+
269 272
     chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
270 273
         conference.onLocalRoleChanged(role);
271 274
 

+ 5
- 0
JitsiConferenceEvents.js Wyświetl plik

@@ -122,6 +122,11 @@ export const KICKED = 'conference.kicked';
122 122
  */
123 123
 export const LAST_N_ENDPOINTS_CHANGED = 'conference.lastNEndpointsChanged';
124 124
 
125
+/**
126
+ * A known participant's live stream URL has changed.
127
+ */
128
+export const LIVE_STREAM_URL_CHANGED = 'conference.liveStreamURLChanged';
129
+
125 130
 /**
126 131
  * Indicates that the room has been locked or unlocked.
127 132
  */

+ 35
- 1
modules/xmpp/ChatRoom.js Wyświetl plik

@@ -418,6 +418,18 @@ export default class ChatRoom extends Listenable {
418 418
                 && this.options.hiddenDomain
419 419
                     === jid.substring(jid.indexOf('@') + 1, jid.indexOf('/'));
420 420
 
421
+        // Check isHiddenDomain as a way to verify a live stream URL is from a
422
+        // trusted source. This prevents users from trying to display arbitrary
423
+        // live stream URLs.
424
+        if (member.isHiddenDomain) {
425
+            const liveStreamViewURLItem
426
+                = pres.getElementsByTagName('live-stream-view-url')[0];
427
+
428
+            if (liveStreamViewURLItem) {
429
+                member.liveStreamViewURL = liveStreamViewURLItem.textContent;
430
+            }
431
+        }
432
+
421 433
         const xEl = pres.querySelector('x');
422 434
 
423 435
         if (xEl) {
@@ -517,6 +529,13 @@ export default class ChatRoom extends Listenable {
517 529
                     member.status,
518 530
                     member.identity);
519 531
 
532
+                if (member.liveStreamViewURL) {
533
+                    this.eventEmitter.emit(
534
+                        XMPPEvents.LIVE_STREAM_URL_CHANGE,
535
+                        from,
536
+                        member.liveStreamViewURL);
537
+                }
538
+
520 539
                 // we are reporting the status with the join
521 540
                 // so we do not want a second event about status update
522 541
                 hasStatusUpdate = false;
@@ -556,6 +575,15 @@ export default class ChatRoom extends Listenable {
556 575
                 hasStatusUpdate = true;
557 576
                 memberOfThis.status = member.status;
558 577
             }
578
+
579
+            if (memberOfThis.liveStreamViewURL !== member.liveStreamViewURL) {
580
+                memberOfThis.liveStreamViewURL = member.liveStreamViewURL;
581
+                this.eventEmitter.emit(
582
+                    XMPPEvents.LIVE_STREAM_URL_CHANGE,
583
+                    from,
584
+                    member.liveStreamViewURL);
585
+            }
586
+
559 587
         }
560 588
 
561 589
         // after we had fired member or room joined events, lets fire events
@@ -754,7 +782,6 @@ export default class ChatRoom extends Listenable {
754 782
      * whether this is the focus that left
755 783
      */
756 784
     onParticipantLeft(jid, skipEvents) {
757
-
758 785
         delete this.lastPresences[jid];
759 786
 
760 787
         if (skipEvents) {
@@ -812,6 +839,13 @@ export default class ChatRoom extends Listenable {
812 839
         const membersKeys = Object.keys(this.members);
813 840
 
814 841
         if (!isSelfPresence) {
842
+            if (this.members[from].liveStreamViewURL) {
843
+                this.eventEmitter.emit(
844
+                    XMPPEvents.LIVE_STREAM_URL_CHANGE,
845
+                    from,
846
+                    undefined);
847
+            }
848
+
815 849
             delete this.members[from];
816 850
             this.onParticipantLeft(from, false);
817 851
         } else if (membersKeys.length > 0) {

+ 2
- 1
modules/xmpp/recording.js Wyświetl plik

@@ -191,7 +191,8 @@ Recording.prototype.setRecordingJibri = function(
191 191
                 'streamid':
192 192
                     this.type === Recording.types.JIBRI
193 193
                         ? options.streamId
194
-                        : undefined
194
+                        : undefined,
195
+                'you_tube_broadcast_id': options.broadcastId
195 196
             })
196 197
             .up();
197 198
 

+ 4
- 0
service/xmpp/XMPPEvents.js Wyświetl plik

@@ -90,6 +90,10 @@ const XMPPEvents = {
90 90
     // Designates an event indicating that we were kicked from the XMPP MUC.
91 91
     KICKED: 'xmpp.kicked',
92 92
 
93
+    // Designates an event indicating that a participant's live stream URL has
94
+    // been updated.
95
+    LIVE_STREAM_URL_CHANGE: 'xmpp.live_stream_url_changed',
96
+
93 97
     // Designates an event indicating that our role in the XMPP MUC has changed.
94 98
     LOCAL_ROLE_CHANGED: 'xmpp.localrole_changed',
95 99
 

Ładowanie…
Anuluj
Zapisz