Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(test) Switch to using 'streamingStatus' on the track for checking… (#13055)
Jaya Allamsetty466a36dc93bb
diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.jsindex 6b79dfee85..3691a0117c 100644--- a/modules/UI/videolayout/VideoContainer.js+++ b/modules/UI/videolayout/VideoContainer.js@@ -6,9 +6,8 @@ import React from 'react';import ReactDOM from 'react-dom';import { browser } from '../../../react/features/base/lib-jitsi-meet';-import { isTestModeEnabled } from '../../../react/features/base/testing';import { FILMSTRIP_BREAKPOINT } from '../../../react/features/filmstrip';-import { LargeVideoBackground, ORIENTATION, updateLastLargeVideoMediaEvent } from '../../../react/features/large-video';+import { LargeVideoBackground, ORIENTATION } from '../../../react/features/large-video';import { setLargeVideoDimensions } from '../../../react/features/large-video/actions.any';import { LAYOUTS, getCurrentLayout } from '../../../react/features/video-layout';/* eslint-enable no-unused-vars */@@ -22,15 +21,6 @@ export const VIDEO_CONTAINER_TYPE = 'camera';const FADE_DURATION_MS = 300;-/**- * List of container events that we are going to process, will be added as listener to the- * container for every event in the list. The latest event will be stored in redux.- */-const containerEvents = [- 'abort', 'canplay', 'canplaythrough', 'emptied', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart',- 'pause', 'play', 'playing', 'ratechange', 'stalled', 'suspend', 'waiting'-];-/*** Returns an array of the video dimensions, so that it keeps it's aspect* ratio and fits available area with it's larger dimension. This method@@ -266,14 +256,6 @@ export class VideoContainer extends LargeContainer {this._resizeListeners = new Set();this.$video[0].onresize = this._onResize.bind(this);-- if (isTestModeEnabled(APP.store.getState())) {- const cb = name => APP.store.dispatch(updateLastLargeVideoMediaEvent(name));-- containerEvents.forEach(event => {- this.$video[0].addEventListener(event, cb.bind(this, event));- });- }}/**diff --git a/react/features/base/testing/functions.ts b/react/features/base/testing/functions.tsindex 140801a53b..4b44e99664 100644--- a/react/features/base/testing/functions.ts+++ b/react/features/base/testing/functions.ts@@ -1,4 +1,5 @@import { IReduxState, IStore } from '../../app/types';+import { isTrackStreamingStatusActive } from '../../connection-indicator/functions';import { MEDIA_TYPE, VIDEO_TYPE } from '../media/constants';import { getParticipantById, isScreenShareParticipant } from '../participants/functions';import { getTrackByMediaTypeAndParticipant, getVideoTrackByParticipant } from '../tracks/functions';@@ -46,10 +47,8 @@ export function isLargeVideoReceived({ getState }: IStore): boolean {const largeVideoParticipantId = state['features/large-video'].participantId ?? '';const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId ?? '');const videoTrack = getVideoTrackByParticipant(state, largeVideoParticipant);- const lastMediaEvent = state['features/large-video']?.lastMediaEvent;- return Boolean(videoTrack && !videoTrack.muted- && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough'));+ return Boolean(videoTrack && !videoTrack.muted && isTrackStreamingStatusActive(videoTrack));}/**@@ -63,8 +62,6 @@ export function isRemoteVideoReceived({ getState }: IStore, id: string): booleanconst state = getState();const participant = getParticipantById(state, id);const videoTrack = getVideoTrackByParticipant(state, participant);- const lastMediaEvent = videoTrack?.lastMediaEvent;- return Boolean(videoTrack && !videoTrack.muted- && (lastMediaEvent === 'playing' || lastMediaEvent === 'canplaythrough'));+ return Boolean(videoTrack && !videoTrack.muted && isTrackStreamingStatusActive(videoTrack));}diff --git a/react/features/base/tracks/actionTypes.ts b/react/features/base/tracks/actionTypes.tsindex 705c1a5831..26b5b66d9c 100644--- a/react/features/base/tracks/actionTypes.ts+++ b/react/features/base/tracks/actionTypes.ts@@ -126,14 +126,3 @@ export const TRACK_UPDATED = 'TRACK_UPDATED';* }*/export const TRACK_WILL_CREATE = 'TRACK_WILL_CREATE';--/**- * Action to update the redux store with the current media event name of the video track.- *- * @returns {{- * type: TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,- * track: Track,- * name: string- * }}- */-export const TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT = 'TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT';diff --git a/react/features/base/tracks/actions.any.ts b/react/features/base/tracks/actions.any.tsindex bfc8615311..c360f1dfc4 100644--- a/react/features/base/tracks/actions.any.ts+++ b/react/features/base/tracks/actions.any.ts@@ -31,7 +31,6 @@ import {TRACK_REMOVED,TRACK_STOPPED,TRACK_UPDATED,- TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,TRACK_WILL_CREATE} from './actionTypes';import {@@ -826,29 +825,6 @@ export function setNoSrcDataNotificationUid(uid?: string) {};}-/**- * Updates the last media event received for a video track.- *- * @param {JitsiRemoteTrack} track - JitsiTrack instance.- * @param {string} name - The current media event name for the video.- * @returns {{- * type: TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,- * track: Track,- * name: string- * }}- */-export function updateLastTrackVideoMediaEvent(track: any, name: string): {- name: string;- track: any;- type: 'TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT';-} {- return {- type: TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,- track,- name- };-}-/*** Toggles the facingMode constraint on the video stream.*diff --git a/react/features/base/tracks/reducer.ts b/react/features/base/tracks/reducer.tsindex 7f12ec9595..a616d3470d 100644--- a/react/features/base/tracks/reducer.ts+++ b/react/features/base/tracks/reducer.ts@@ -11,7 +11,6 @@ import {TRACK_OWNER_CHANGED,TRACK_REMOVED,TRACK_UPDATED,- TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,TRACK_WILL_CREATE} from './actionTypes';import { ITrack } from './types';@@ -73,20 +72,7 @@ function track(state: ITrack, action: any) {}break;}- case TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT: {- const t = action.track;-- if (state.jitsiTrack === t) {- if (state.lastMediaEvent !== action.name) {- return {- ...state,- lastMediaEvent: action.name- };- }- }- break;- }case TRACK_NO_DATA_FROM_SOURCE: {const t = action.track;@@ -117,7 +103,6 @@ ReducerRegistry.register<ITracksState>('features/base/tracks', (state = [], acticase PARTICIPANT_ID_CHANGED:case TRACK_NO_DATA_FROM_SOURCE:case TRACK_OWNER_CHANGED:- case TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT:case TRACK_UPDATED:return state.map((t: ITrack) => track(t, action));case TRACK_ADDED: {diff --git a/react/features/base/tracks/types.ts b/react/features/base/tracks/types.tsindex 283ccca3fc..51a41bc841 100644--- a/react/features/base/tracks/types.ts+++ b/react/features/base/tracks/types.ts@@ -46,7 +46,6 @@ export interface ITrackOptions {export interface ITrack {isReceivingData: boolean;jitsiTrack: any;- lastMediaEvent?: string;local: boolean;mediaType: MediaType;mirror: boolean;diff --git a/react/features/filmstrip/components/web/Thumbnail.tsx b/react/features/filmstrip/components/web/Thumbnail.tsxindex 6177b46373..d0ce7b67f4 100644--- a/react/features/filmstrip/components/web/Thumbnail.tsx+++ b/react/features/filmstrip/components/web/Thumbnail.tsx@@ -29,10 +29,9 @@ import {} from '../../../base/participants/functions';import { IParticipant } from '../../../base/participants/types';import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';-import { isTestModeEnabled } from '../../../base/testing/functions';// @ts-ignoreimport { Tooltip } from '../../../base/tooltip';-import { trackStreamingStatusChanged, updateLastTrackVideoMediaEvent } from '../../../base/tracks/actions';+import { trackStreamingStatusChanged } from '../../../base/tracks/actions';import {getLocalAudioTrack,getTrackByMediaTypeAndParticipant,@@ -51,8 +50,7 @@ import {DISPLAY_VIDEO,FILMSTRIP_TYPE,SHOW_TOOLBAR_CONTEXT_MENU_AFTER,- THUMBNAIL_TYPE,- VIDEO_TEST_EVENTS+ THUMBNAIL_TYPE} from '../../constants';import {computeDisplayModeFromInput,@@ -169,11 +167,6 @@ export interface IProps extends WithTranslation {*/_isScreenSharing: boolean;- /**- * Indicates whether testing mode is enabled.- */- _isTestModeEnabled: boolean;-/*** Indicates whether the video associated with the thumbnail is playable.*/@@ -441,7 +434,6 @@ class Thumbnail extends Component<IProps, IState> {this.timeoutHandle = undefined;this.containerRef = createRef<HTMLSpanElement>();this._clearDoubleClickTimeout = this._clearDoubleClickTimeout.bind(this);- this._onCanPlay = this._onCanPlay.bind(this);this._onClick = this._onClick.bind(this);this._onTogglePinButtonKeyDown = this._onTogglePinButtonKeyDown.bind(this);this._onFocus = this._onFocus.bind(this);@@ -452,7 +444,6 @@ class Thumbnail extends Component<IProps, IState> {trailing: false});this._onMouseLeave = this._onMouseLeave.bind(this);- this._onTestingEvent = this._onTestingEvent.bind(this);this._onTouchStart = this._onTouchStart.bind(this);this._onTouchEnd = this._onTouchEnd.bind(this);this._onTouchMove = this._onTouchMove.bind(this);@@ -1006,41 +997,6 @@ class Thumbnail extends Component<IProps, IState> {);}- /**- * Canplay event listener.- *- * @param {SyntheticEvent} event - The event.- * @returns {void}- */- _onCanPlay(event: any) {- this.setState({ canPlayEventReceived: true });-- const {- _isTestModeEnabled,- _videoTrack- } = this.props;-- if (_videoTrack && _isTestModeEnabled) {- this._onTestingEvent(event);- }- }-- /**- * Event handler for testing events.- *- * @param {SyntheticEvent} event - The event.- * @returns {void}- */- _onTestingEvent(event: any) {- const {- _videoTrack,- dispatch- } = this.props;- const jitsiVideoTrack = _videoTrack?.jitsiTrack;-- dispatch(updateLastTrackVideoMediaEvent(jitsiVideoTrack, event.type));- }-/*** Renders a remote participant's 'thumbnail.*@@ -1055,7 +1011,6 @@ class Thumbnail extends Component<IProps, IState> {_isMobile,_isMobilePortrait,_isScreenSharing,- _isTestModeEnabled,_localFlipX,_participant,_shouldDisplayTintBackground,@@ -1083,13 +1038,6 @@ class Thumbnail extends Component<IProps, IState> {styles.thumbnail.height = styles.thumbnail.width;containerClassName = `${containerClassName} self-view-mobile-portrait`;}- } else {- if (_videoTrack && _isTestModeEnabled) {- VIDEO_TEST_EVENTS.forEach(attribute => {- videoEventListeners[attribute] = this._onTestingEvent;- });- }- videoEventListeners.onCanPlay = this._onCanPlay;}const video = _videoTrack && <VideoTrack@@ -1204,12 +1152,10 @@ class Thumbnail extends Component<IProps, IState> {*/render() {const {- _isTestModeEnabled,_isVirtualScreenshareParticipant,_participant,_shouldDisplayTintBackground} = this.props;- const videoEventListeners: any = {};if (!_participant) {return null;@@ -1232,13 +1178,6 @@ class Thumbnail extends Component<IProps, IState> {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 (<VirtualScreenshareParticipantclasses = { classes }@@ -1404,7 +1343,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any): Object {_isMobile,_isMobilePortrait,_isScreenSharing: _videoTrack?.videoType === 'desktop',- _isTestModeEnabled: isTestModeEnabled(state),_isVideoPlayable: id && isVideoPlayable(state, id),_isVirtualScreenshareParticipant,_localFlipX: Boolean(localFlipX),diff --git a/react/features/filmstrip/constants.ts b/react/features/filmstrip/constants.tsindex a408346264..e6e030ca42 100644--- a/react/features/filmstrip/constants.ts+++ b/react/features/filmstrip/constants.ts@@ -63,30 +63,6 @@ export const DEFAULT_MAX_COLUMNS = 5;*/export const ABSOLUTE_MAX_COLUMNS = 7;-/**- * An array of attributes of the video element that will be used for adding a listener for every event in the list.- * The latest event will be stored in redux. This is currently used by torture only.- */-export const VIDEO_TEST_EVENTS = [- 'onAbort',- 'onCanPlay',- 'onCanPlayThrough',- 'onEmptied',- 'onEnded',- 'onError',- 'onLoadedData',- 'onLoadedMetadata',- 'onLoadStart',- 'onPause',- 'onPlay',- 'onPlaying',- 'onRateChange',- 'onStalled',- 'onSuspend',- 'onWaiting'-];--/*** Display mode constant used when video is being displayed on the small video.*diff --git a/react/features/large-video/actionTypes.ts b/react/features/large-video/actionTypes.tsindex 02e1fd49d0..1f88ef10cc 100644--- a/react/features/large-video/actionTypes.ts+++ b/react/features/large-video/actionTypes.ts@@ -31,17 +31,6 @@ export const SET_LARGE_VIDEO_DIMENSIONS = 'SET_LARGE_VIDEO_DIMENSIONS';export const UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION= 'UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION';-/**- * Action to update the redux store with the current media event name of large video.- *- * @returns {{- * type: UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT,- * name: string- * }}- */-export const UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT- = 'UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT';-/*** Action to set the redux store of the current show me what I'm sharing flag value.*diff --git a/react/features/large-video/actions.web.ts b/react/features/large-video/actions.web.tsindex a35a6f09ae..45120fcc26 100644--- a/react/features/large-video/actions.web.ts+++ b/react/features/large-video/actions.web.ts@@ -4,7 +4,7 @@ import { IStore } from '../app/types';import { MEDIA_TYPE } from '../base/media/constants';import { getTrackByMediaTypeAndParticipant } from '../base/tracks/functions.web';-import { SET_SEE_WHAT_IS_BEING_SHARED, UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT } from './actionTypes';+import { SET_SEE_WHAT_IS_BEING_SHARED } from './actionTypes';export * from './actions.any';@@ -84,22 +84,6 @@ export function resizeLargeVideo(width: number, height: number) {};}-/**- * Updates the last media event received for the large video.- *- * @param {string} name - The current media event name for the video.- * @returns {{- * type: UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT,- * name: string- * }}- */-export function updateLastLargeVideoMediaEvent(name: String) {- return {- type: UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT,- name- };-}-/*** Updates the value used to display what is being shared.*diff --git a/react/features/large-video/reducer.ts b/react/features/large-video/reducer.tsindex 8e83de1ad5..7456bd8e4c 100644--- a/react/features/large-video/reducer.ts+++ b/react/features/large-video/reducer.ts@@ -5,13 +5,11 @@ import {SELECT_LARGE_VIDEO_PARTICIPANT,SET_LARGE_VIDEO_DIMENSIONS,SET_SEE_WHAT_IS_BEING_SHARED,- UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION,- UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT+ UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION} from './actionTypes';export interface ILargeVideoState {height?: number;- lastMediaEvent?: string;participantId?: string;resolution?: number;seeWhatIsBeingShared?: boolean;@@ -54,12 +52,6 @@ ReducerRegistry.register<ILargeVideoState>('features/large-video', (state = {},resolution: action.resolution};- case UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT:- return {- ...state,- lastMediaEvent: action.name- };-case SET_SEE_WHAT_IS_BEING_SHARED:return {...state,