Просмотр исходного кода

Get participant specific video element

* Get participant specific video element

We now have the ability to select the video element for specific participants. I'm tweaking the jitsi-meet-electron app for my use case. I need to open Always On Top windows for specific participants, so the current _getLargeVideo() wont suffice.

I made a post about this in the Developers section on the Jitsi Community Forum, but it got blocked by Akismet.

* Add dots at end of sentence.

* Fixed ESlint errors and add additional check for iframe.

* Use _myUserID instead of string.

* Return the local video by default if participantId is undefined.

* Fixed mistake in string template.
master
Jip-Hop 5 лет назад
Родитель
Сommit
2c70388a9e
1 измененных файлов: 24 добавлений и 0 удалений
  1. 24
    0
      modules/API/external/external_api.js

+ 24
- 0
modules/API/external/external_api.js Просмотреть файл

@@ -366,6 +366,30 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
366 366
         return iframe.contentWindow.document.getElementById('largeVideo');
367 367
     }
368 368
 
369
+    /**
370
+     * Getter for participant specific video element in Jitsi Meet.
371
+     *
372
+     * @param {string|undefined} participantId - Id of participant to return the video for.
373
+     *
374
+     * @returns {HTMLElement|undefined} - The requested video. Will return the local video
375
+     * by default if participantId is undefined.
376
+     */
377
+    _getParticipantVideo(participantId) {
378
+        const iframe = this.getIFrame();
379
+
380
+        if (!iframe
381
+                || !iframe.contentWindow
382
+                || !iframe.contentWindow.document) {
383
+            return;
384
+        }
385
+
386
+        if (typeof participantId === 'undefined' || participantId === this._myUserID) {
387
+            return iframe.contentWindow.document.getElementById('localVideo_container');
388
+        }
389
+
390
+        return iframe.contentWindow.document.querySelector(`#participant_${participantId} video`);
391
+    }
392
+
369 393
     /**
370 394
      * Sets the size of the iframe element.
371 395
      *

Загрузка…
Отмена
Сохранить