fix(testing): Fixes for multi-stream torture tests to work.
This commit is contained in:
parent
7509b520f3
commit
7393c20ed8
|
@ -1,7 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { MEDIA_TYPE } from '../media';
|
import { getMultipleVideoSupportFeatureFlag } from '../config';
|
||||||
import { getTrackByMediaTypeAndParticipant } from '../tracks';
|
import { MEDIA_TYPE, VIDEO_TYPE } from '../media';
|
||||||
|
import { getParticipantById } from '../participants';
|
||||||
|
import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../tracks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the test mode is enabled. When it's enabled
|
* Indicates whether the test mode is enabled. When it's enabled
|
||||||
|
@ -22,10 +24,17 @@ export function isTestModeEnabled(state: Object): boolean {
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store.
|
* @param {Store} store - The redux store.
|
||||||
* @param {string} id - The participant ID for the remote video.
|
* @param {string} id - The participant ID for the remote video.
|
||||||
* @returns {MEDIA_TYPE}
|
* @returns {VIDEO_TYPE}
|
||||||
*/
|
*/
|
||||||
export function getRemoteVideoType({ getState }: Object, id: String): boolean {
|
export function getRemoteVideoType({ getState }: Object, id: String): VIDEO_TYPE {
|
||||||
return getTrackByMediaTypeAndParticipant(getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, id)?.videoType;
|
const state = getState();
|
||||||
|
const participant = getParticipantById(state, id);
|
||||||
|
|
||||||
|
if (getMultipleVideoSupportFeatureFlag(state) && participant?.isVirtualScreenshareParticipant) {
|
||||||
|
return VIDEO_TYPE.DESKTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id)?.videoType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,10 +44,19 @@ export function getRemoteVideoType({ getState }: Object, id: String): boolean {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isLargeVideoReceived({ getState }: Object): boolean {
|
export function isLargeVideoReceived({ getState }: Object): boolean {
|
||||||
const largeVideoParticipantId = getState()['features/large-video'].participantId;
|
const state = getState();
|
||||||
const videoTrack = getTrackByMediaTypeAndParticipant(
|
const largeVideoParticipantId = state['features/large-video'].participantId;
|
||||||
getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, largeVideoParticipantId);
|
const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId);
|
||||||
const lastMediaEvent = getState()['features/large-video']?.lastMediaEvent;
|
const tracks = state['features/base/tracks'];
|
||||||
|
let videoTrack;
|
||||||
|
|
||||||
|
if (getMultipleVideoSupportFeatureFlag(state) && largeVideoParticipant?.isVirtualScreenshareParticipant) {
|
||||||
|
videoTrack = getVirtualScreenshareParticipantTrack(tracks, largeVideoParticipantId);
|
||||||
|
} else {
|
||||||
|
videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideoParticipantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastMediaEvent = state['features/large-video']?.lastMediaEvent;
|
||||||
|
|
||||||
return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');
|
return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');
|
||||||
}
|
}
|
||||||
|
@ -51,7 +69,16 @@ export function isLargeVideoReceived({ getState }: Object): boolean {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isRemoteVideoReceived({ getState }: Object, id: String): boolean {
|
export function isRemoteVideoReceived({ getState }: Object, id: String): boolean {
|
||||||
const videoTrack = getTrackByMediaTypeAndParticipant(getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
|
const state = getState();
|
||||||
|
const tracks = state['features/base/tracks'];
|
||||||
|
const participant = getParticipantById(state, id);
|
||||||
|
let videoTrack;
|
||||||
|
|
||||||
|
if (getMultipleVideoSupportFeatureFlag(state) && participant?.isVirtualScreenshareParticipant) {
|
||||||
|
videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
|
||||||
|
} else {
|
||||||
|
videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id);
|
||||||
|
}
|
||||||
const lastMediaEvent = videoTrack?.lastMediaEvent;
|
const lastMediaEvent = videoTrack?.lastMediaEvent;
|
||||||
|
|
||||||
return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');
|
return videoTrack && !videoTrack.muted && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough');
|
||||||
|
|
|
@ -1106,13 +1106,14 @@ class Thumbnail extends Component<Props, State> {
|
||||||
* @returns {ReactElement}
|
* @returns {ReactElement}
|
||||||
*/
|
*/
|
||||||
render() {
|
render() {
|
||||||
const { _participant, _isVirtualScreenshareParticipant } = this.props;
|
const { _participant, _isTestModeEnabled, _isVirtualScreenshareParticipant } = this.props;
|
||||||
|
const videoEventListeners: any = {};
|
||||||
|
|
||||||
if (!_participant) {
|
if (!_participant) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isFakeParticipant, local } = _participant;
|
const { isFakeParticipant, isLocalScreenShare, local } = _participant;
|
||||||
|
|
||||||
if (local) {
|
if (local) {
|
||||||
return this._renderParticipant(true);
|
return this._renderParticipant(true);
|
||||||
|
@ -1126,12 +1127,19 @@ class Thumbnail extends Component<Props, State> {
|
||||||
const { isHovered } = this.state;
|
const { isHovered } = this.state;
|
||||||
const { _videoTrack, _isMobile, classes, _thumbnailType } = this.props;
|
const { _videoTrack, _isMobile, classes, _thumbnailType } = this.props;
|
||||||
|
|
||||||
|
if (_isTestModeEnabled) {
|
||||||
|
VIDEO_TEST_EVENTS.forEach(attribute => {
|
||||||
|
videoEventListeners[attribute] = this._onTestingEvent;
|
||||||
|
});
|
||||||
|
videoEventListeners.onCanPlay = this._onCanPlay;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VirtualScreenshareParticipant
|
<VirtualScreenshareParticipant
|
||||||
classes = { classes }
|
classes = { classes }
|
||||||
containerClassName = { this._getContainerClassName() }
|
containerClassName = { this._getContainerClassName() }
|
||||||
isHovered = { isHovered }
|
isHovered = { isHovered }
|
||||||
isLocal = { local }
|
isLocal = { isLocalScreenShare }
|
||||||
isMobile = { _isMobile }
|
isMobile = { _isMobile }
|
||||||
onClick = { this._onClick }
|
onClick = { this._onClick }
|
||||||
onMouseEnter = { this._onMouseEnter }
|
onMouseEnter = { this._onMouseEnter }
|
||||||
|
@ -1165,12 +1173,13 @@ function _mapStateToProps(state: IState, ownProps: any): Object {
|
||||||
const participant = getParticipantByIdOrUndefined(state, participantID);
|
const participant = getParticipantByIdOrUndefined(state, participantID);
|
||||||
const id = participant?.id;
|
const id = participant?.id;
|
||||||
const isLocal = participant?.local ?? true;
|
const isLocal = participant?.local ?? true;
|
||||||
const tracks = state['features/base/tracks'];
|
const multipleVideoSupportEnabled = getMultipleVideoSupportFeatureFlag(state);
|
||||||
const sourceNameSignalingEnabled = getSourceNameSignalingFeatureFlag(state);
|
const sourceNameSignalingEnabled = getSourceNameSignalingFeatureFlag(state);
|
||||||
|
const tracks = state['features/base/tracks'];
|
||||||
|
|
||||||
let _videoTrack;
|
let _videoTrack;
|
||||||
|
|
||||||
if (sourceNameSignalingEnabled && participant?.isVirtualScreenshareParticipant) {
|
if (multipleVideoSupportEnabled && participant?.isVirtualScreenshareParticipant) {
|
||||||
_videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
|
_videoTrack = getVirtualScreenshareParticipantTrack(tracks, id);
|
||||||
} else {
|
} else {
|
||||||
_videoTrack = isLocal
|
_videoTrack = isLocal
|
||||||
|
@ -1293,19 +1302,19 @@ function _mapStateToProps(state: IState, ownProps: any): Object {
|
||||||
_isScreenSharing: _videoTrack?.videoType === 'desktop',
|
_isScreenSharing: _videoTrack?.videoType === 'desktop',
|
||||||
_isTestModeEnabled: isTestModeEnabled(state),
|
_isTestModeEnabled: isTestModeEnabled(state),
|
||||||
_isVideoPlayable: id && isVideoPlayable(state, id),
|
_isVideoPlayable: id && isVideoPlayable(state, id),
|
||||||
_isVirtualScreenshareParticipant: sourceNameSignalingEnabled && participant?.isVirtualScreenshareParticipant,
|
_isVirtualScreenshareParticipant: multipleVideoSupportEnabled && participant?.isVirtualScreenshareParticipant,
|
||||||
_localFlipX: Boolean(localFlipX),
|
_localFlipX: Boolean(localFlipX),
|
||||||
_multipleVideoSupport: getMultipleVideoSupportFeatureFlag(state),
|
_multipleVideoSupport: multipleVideoSupportEnabled,
|
||||||
_participant: participant,
|
_participant: participant,
|
||||||
_raisedHand: hasRaisedHand(participant),
|
_raisedHand: hasRaisedHand(participant),
|
||||||
|
_sourceNameSignalingEnabled: sourceNameSignalingEnabled,
|
||||||
_stageFilmstripLayout: isStageFilmstripAvailable(state),
|
_stageFilmstripLayout: isStageFilmstripAvailable(state),
|
||||||
_stageParticipantsVisible: _currentLayout === LAYOUTS.STAGE_FILMSTRIP_VIEW,
|
_stageParticipantsVisible: _currentLayout === LAYOUTS.STAGE_FILMSTRIP_VIEW,
|
||||||
_thumbnailType: tileType,
|
_thumbnailType: tileType,
|
||||||
_videoObjectPosition: getVideoObjectPosition(state, participant?.id),
|
_videoObjectPosition: getVideoObjectPosition(state, participant?.id),
|
||||||
_videoTrack,
|
_videoTrack,
|
||||||
...size,
|
...size,
|
||||||
_gifSrc: mode === 'chat' ? null : gifSrc,
|
_gifSrc: mode === 'chat' ? null : gifSrc
|
||||||
_sourceNameSignalingEnabled: sourceNameSignalingEnabled
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue