fix(iFrame): capturScreenshot - check if the remote participant has a track attached.

Participants that join video muted do not have video tracks attached. Fixes https://github.com/jitsi/jitsi-meet/issues/7942.
This commit is contained in:
Jaya Allamsetty 2020-10-21 16:08:05 -04:00 committed by Jaya Allamsetty
parent d067c4e731
commit 4b429112f2
1 changed files with 14 additions and 4 deletions

View File

@ -17,20 +17,30 @@ export function captureLargeVideoScreenshot() {
return (dispatch: Dispatch<any>, getState: Function): Promise<string> => { return (dispatch: Dispatch<any>, getState: Function): Promise<string> => {
const state = getState(); const state = getState();
const largeVideo = state['features/large-video']; const largeVideo = state['features/large-video'];
const promise = Promise.resolve();
if (!largeVideo) { if (!largeVideo) {
return Promise.resolve(); return promise;
} }
const tracks = state['features/base/tracks']; const tracks = state['features/base/tracks'];
const { jitsiTrack } = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideo.participantId); const participantTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideo.participantId);
const videoStream = jitsiTrack.getOriginalStream();
// Participants that join the call video muted do not have a jitsiTrack attached.
if (!(participantTrack && participantTrack.jitsiTrack)) {
return promise;
}
const videoStream = participantTrack.jitsiTrack.getOriginalStream();
if (!videoStream) {
return promise;
}
// Get the video element for the large video, cast HTMLElement to HTMLVideoElement to make flow happy. // Get the video element for the large video, cast HTMLElement to HTMLVideoElement to make flow happy.
/* eslint-disable-next-line no-extra-parens*/ /* eslint-disable-next-line no-extra-parens*/
const videoElement = ((document.getElementById('largeVideo'): any): HTMLVideoElement); const videoElement = ((document.getElementById('largeVideo'): any): HTMLVideoElement);
if (!videoElement) { if (!videoElement) {
return Promise.resolve(); return promise;
} }
// Create a HTML canvas and draw video on to the canvas. // Create a HTML canvas and draw video on to the canvas.