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