Browse Source

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 years ago
parent
commit
4f0b8fd39c

+ 13
- 0
JitsiConference.js View File

1264
         displayName);
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
  * Notifies this JitsiConference that a JitsiRemoteTrack was added into
1281
  * Notifies this JitsiConference that a JitsiRemoteTrack was added into
1269
  * the conference.
1282
  * the conference.

+ 3
- 0
JitsiConferenceEventManager.js View File

266
     chatRoom.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
266
     chatRoom.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
267
         conference.onDisplayNameChanged.bind(conference));
267
         conference.onDisplayNameChanged.bind(conference));
268
 
268
 
269
+    chatRoom.addListener(XMPPEvents.LIVE_STREAM_URL_CHANGE,
270
+        conference.onLiveStreamURLChange.bind(conference));
271
+
269
     chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
272
     chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
270
         conference.onLocalRoleChanged(role);
273
         conference.onLocalRoleChanged(role);
271
 
274
 

+ 5
- 0
JitsiConferenceEvents.js View File

122
  */
122
  */
123
 export const LAST_N_ENDPOINTS_CHANGED = 'conference.lastNEndpointsChanged';
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
  * Indicates that the room has been locked or unlocked.
131
  * Indicates that the room has been locked or unlocked.
127
  */
132
  */

+ 35
- 1
modules/xmpp/ChatRoom.js View File

418
                 && this.options.hiddenDomain
418
                 && this.options.hiddenDomain
419
                     === jid.substring(jid.indexOf('@') + 1, jid.indexOf('/'));
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
         const xEl = pres.querySelector('x');
433
         const xEl = pres.querySelector('x');
422
 
434
 
423
         if (xEl) {
435
         if (xEl) {
517
                     member.status,
529
                     member.status,
518
                     member.identity);
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
                 // we are reporting the status with the join
539
                 // we are reporting the status with the join
521
                 // so we do not want a second event about status update
540
                 // so we do not want a second event about status update
522
                 hasStatusUpdate = false;
541
                 hasStatusUpdate = false;
556
                 hasStatusUpdate = true;
575
                 hasStatusUpdate = true;
557
                 memberOfThis.status = member.status;
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
         // after we had fired member or room joined events, lets fire events
589
         // after we had fired member or room joined events, lets fire events
754
      * whether this is the focus that left
782
      * whether this is the focus that left
755
      */
783
      */
756
     onParticipantLeft(jid, skipEvents) {
784
     onParticipantLeft(jid, skipEvents) {
757
-
758
         delete this.lastPresences[jid];
785
         delete this.lastPresences[jid];
759
 
786
 
760
         if (skipEvents) {
787
         if (skipEvents) {
812
         const membersKeys = Object.keys(this.members);
839
         const membersKeys = Object.keys(this.members);
813
 
840
 
814
         if (!isSelfPresence) {
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
             delete this.members[from];
849
             delete this.members[from];
816
             this.onParticipantLeft(from, false);
850
             this.onParticipantLeft(from, false);
817
         } else if (membersKeys.length > 0) {
851
         } else if (membersKeys.length > 0) {

+ 2
- 1
modules/xmpp/recording.js View File

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

+ 4
- 0
service/xmpp/XMPPEvents.js View File

90
     // Designates an event indicating that we were kicked from the XMPP MUC.
90
     // Designates an event indicating that we were kicked from the XMPP MUC.
91
     KICKED: 'xmpp.kicked',
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
     // Designates an event indicating that our role in the XMPP MUC has changed.
97
     // Designates an event indicating that our role in the XMPP MUC has changed.
94
     LOCAL_ROLE_CHANGED: 'xmpp.localrole_changed',
98
     LOCAL_ROLE_CHANGED: 'xmpp.localrole_changed',
95
 
99
 

Loading…
Cancel
Save