diff --git a/react/features/base/tracks/functions.js b/react/features/base/tracks/functions.js index c1af20478..cbb61b58d 100644 --- a/react/features/base/tracks/functions.js +++ b/react/features/base/tracks/functions.js @@ -352,6 +352,12 @@ export function getLocalCameraTrack(tracks) { .find(t => t.videoType === VIDEO_TYPE.CAMERA); } +// eslint-disable-next-line require-jsdoc +export function getLocalScreenTrack(tracks) { + return getLocalTracks(tracks, false) + .find(t => t.videoType === VIDEO_TYPE.DESKTOP); +} + /** * Returns the media type of the local video, presenter or video. * @@ -405,6 +411,24 @@ export function getTrackByMediaTypeAndParticipant( ); } +// eslint-disable-next-line require-jsdoc +export function getParticipantsCameraTrack(tracks, participantId) { + return tracks.find( + t => Boolean(t.jitsiTrack) + && t.participantId === participantId + && (t.videoType === undefined || t.videoType === VIDEO_TYPE.CAMERA) + ); +} + +// eslint-disable-next-line require-jsdoc +export function getParticipantsScreenTrack(tracks, participantId) { + return tracks.find( + t => Boolean(t.jitsiTrack) + && t.participantId === participantId + && t.videoType === VIDEO_TYPE.DESKTOP + ); +} + // eslint-disable-next-line require-jsdoc export function getLastTrackByMediaTypeAndParticipant( tracks, diff --git a/react/features/filmstrip/components/web/Thumbnail.js b/react/features/filmstrip/components/web/Thumbnail.js index 792d3f848..d9ce6cdda 100644 --- a/react/features/filmstrip/components/web/Thumbnail.js +++ b/react/features/filmstrip/components/web/Thumbnail.js @@ -18,7 +18,10 @@ import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants'; import { isTestModeEnabled } from '../../../base/testing'; import { getLocalAudioTrack, - getLocalVideoTrack, + getLocalCameraTrack, + getLocalScreenTrack, + getParticipantsCameraTrack, + getParticipantsScreenTrack, getTrackByMediaTypeAndParticipant, updateLastTrackVideoMediaEvent } from '../../../base/tracks'; @@ -192,7 +195,9 @@ export type Props = {| /** * Styles that will be set to the Thumbnail's main span element. */ - style?: ?Object + style?: ?Object, + + _hasOnlyScreenStream: boolean, |}; const defaultStyles = theme => { @@ -369,14 +374,14 @@ class Thumbnail extends Component { const { _currentLayout, _isAudioOnly, - _isScreenSharing + _videoTrack } = this.props; const { displayMode } = this.state; const tileViewActive = _currentLayout === LAYOUTS.TILE_VIEW; if (!(DISPLAY_VIDEO === displayMode) && tileViewActive - && _isScreenSharing + && _videoTrack && _videoTrack.videoType === VIDEO_TYPE.DESKTOP && !_isAudioOnly) { sendAnalytics(createScreenSharingIssueEvent({ source: 'thumbnail', @@ -969,6 +974,7 @@ function _mapStateToProps(state, ownProps): Object { _isMobile, _isMobilePortrait, _isScreenSharing: _videoTrack?.videoType === 'desktop', + _hasOnlyScreenStream: Boolean(_screenTrack) && !_cameraTrack, _isTestModeEnabled: isTestModeEnabled(state), _isVideoPlayable: id && isVideoPlayable(state, id), _localFlipX: Boolean(localFlipX), diff --git a/react/features/filmstrip/functions.web.js b/react/features/filmstrip/functions.web.js index 63fdb2437..763608742 100644 --- a/react/features/filmstrip/functions.web.js +++ b/react/features/filmstrip/functions.web.js @@ -295,14 +295,14 @@ export function computeDisplayModeFromInput(input: Object) { const { isAudioOnly, isCurrentlyOnLargeVideo, - isScreenSharing, + hasOnlyScreenStream, canPlayEventReceived, isRemoteParticipant, tileViewActive } = input; const adjustedIsVideoPlayable = input.isVideoPlayable && (!isRemoteParticipant || canPlayEventReceived); - if (!tileViewActive && isScreenSharing && isRemoteParticipant) { + if (!tileViewActive && hasOnlyScreenStream && isRemoteParticipant) { return DISPLAY_AVATAR; } else if (isCurrentlyOnLargeVideo && !tileViewActive) { // Display name is always and only displayed when user is on the stage