Skip to content

Commit

Permalink
Get participant specific video element
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Jip-Hop authored and hristoterezov committed Aug 23, 2019
1 parent e0815de commit 2c70388
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions modules/API/external/external_api.js
Expand Up @@ -366,6 +366,30 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
return iframe.contentWindow.document.getElementById('largeVideo');
}

/**
* Getter for participant specific video element in Jitsi Meet.
*
* @param {string|undefined} participantId - Id of participant to return the video for.
*
* @returns {HTMLElement|undefined} - The requested video. Will return the local video
* by default if participantId is undefined.
*/
_getParticipantVideo(participantId) {
const iframe = this.getIFrame();

if (!iframe
|| !iframe.contentWindow
|| !iframe.contentWindow.document) {
return;
}

if (typeof participantId === 'undefined' || participantId === this._myUserID) {
return iframe.contentWindow.document.getElementById('localVideo_container');
}

return iframe.contentWindow.document.querySelector(`#participant_${participantId} video`);
}

/**
* Sets the size of the iframe element.
*
Expand Down

0 comments on commit 2c70388

Please sign in to comment.