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.
This commit is contained in:
Jip-Hop 2019-08-23 17:35:10 +02:00 committed by Hristo Terezov
parent e0815de2ad
commit 2c70388a9e
1 changed files with 24 additions and 0 deletions

View File

@ -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.
*