diff --git a/JitsiConference.js b/JitsiConference.js index 2246c71806..f91c73406e 100644 --- a/JitsiConference.js +++ b/JitsiConference.js @@ -57,7 +57,7 @@ import CodecMimeType from './service/RTC/CodecMimeType'; import { MediaType } from './service/RTC/MediaType'; import RTCEvents from './service/RTC/RTCEvents'; import { getSourceNameForJitsiTrack } from './service/RTC/SignalingLayer'; -import VideoType from './service/RTC/VideoType'; +import { VideoType } from './service/RTC/VideoType'; import { ACTION_JINGLE_RESTART, ACTION_JINGLE_SI_RECEIVED, diff --git a/JitsiConferenceEventManager.js b/JitsiConferenceEventManager.js index 9ec85b0cfd..482d23f195 100644 --- a/JitsiConferenceEventManager.js +++ b/JitsiConferenceEventManager.js @@ -8,7 +8,7 @@ import Statistics from './modules/statistics/statistics'; import EventEmitterForwarder from './modules/util/EventEmitterForwarder'; import { MediaType } from './service/RTC/MediaType'; import RTCEvents from './service/RTC/RTCEvents'; -import VideoType from './service/RTC/VideoType'; +import { VideoType } from './service/RTC/VideoType'; import AuthenticationEvents from './service/authentication/AuthenticationEvents'; import { diff --git a/modules/RTC/JitsiLocalTrack.js b/modules/RTC/JitsiLocalTrack.js index f34043b9fa..daf763635d 100644 --- a/modules/RTC/JitsiLocalTrack.js +++ b/modules/RTC/JitsiLocalTrack.js @@ -13,7 +13,7 @@ import { import CameraFacingMode from '../../service/RTC/CameraFacingMode'; import { MediaType } from '../../service/RTC/MediaType'; import RTCEvents from '../../service/RTC/RTCEvents'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { NO_BYTES_SENT, TRACK_UNMUTED, diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index 3f73d32b7d..851f24de6e 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -7,7 +7,7 @@ import * as JitsiTrackErrors from '../../JitsiTrackErrors'; import CameraFacingMode from '../../service/RTC/CameraFacingMode'; import RTCEvents from '../../service/RTC/RTCEvents'; import Resolutions from '../../service/RTC/Resolutions'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { AVAILABLE_DEVICE } from '../../service/statistics/AnalyticsEvents'; import browser from '../browser'; import SDPUtil from '../sdp/SDPUtil'; diff --git a/modules/RTC/TPCUtils.js b/modules/RTC/TPCUtils.js index 52c7a97955..c1e9b3a287 100644 --- a/modules/RTC/TPCUtils.js +++ b/modules/RTC/TPCUtils.js @@ -3,7 +3,7 @@ import transform from 'sdp-transform'; import MediaDirection from '../../service/RTC/MediaDirection'; import { MediaType } from '../../service/RTC/MediaType'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import browser from '../browser'; import FeatureFlags from '../flags/FeatureFlags'; diff --git a/modules/RTC/TraceablePeerConnection.js b/modules/RTC/TraceablePeerConnection.js index d0b45d9f4c..0eb0f7554e 100644 --- a/modules/RTC/TraceablePeerConnection.js +++ b/modules/RTC/TraceablePeerConnection.js @@ -8,7 +8,7 @@ import { MediaType } from '../../service/RTC/MediaType'; import RTCEvents from '../../service/RTC/RTCEvents'; import * as SignalingEvents from '../../service/RTC/SignalingEvents'; import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer'; -import * as VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer'; import browser from '../browser'; import FeatureFlags from '../flags/FeatureFlags'; diff --git a/modules/connectivity/ConnectionQuality.js b/modules/connectivity/ConnectionQuality.js index 0f50d8ed2d..d267610321 100644 --- a/modules/connectivity/ConnectionQuality.js +++ b/modules/connectivity/ConnectionQuality.js @@ -7,7 +7,7 @@ import * as ConnectionQualityEvents from '../../service/connectivity/ConnectionQ import browser from '../browser'; const Resolutions = require('../../service/RTC/Resolutions'); -const VideoType = require('../../service/RTC/VideoType'); +const { VideoType } = require('../../service/RTC/VideoType'); const { XMPPEvents } = require('../../service/xmpp/XMPPEvents'); const logger = getLogger(__filename); diff --git a/modules/proxyconnection/ProxyConnectionService.js b/modules/proxyconnection/ProxyConnectionService.js index de822d836f..903dfffcf3 100644 --- a/modules/proxyconnection/ProxyConnectionService.js +++ b/modules/proxyconnection/ProxyConnectionService.js @@ -4,7 +4,7 @@ import { getLogger } from '@jitsi/logger'; import { $iq } from 'strophe.js'; import { MediaType } from '../../service/RTC/MediaType'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import RTC from '../RTC/RTC'; import ProxyConnectionPC from './ProxyConnectionPC'; diff --git a/modules/sdp/LocalSdpMunger.js b/modules/sdp/LocalSdpMunger.js index 79eb9a703c..ba14304ac9 100644 --- a/modules/sdp/LocalSdpMunger.js +++ b/modules/sdp/LocalSdpMunger.js @@ -3,7 +3,7 @@ import { getLogger } from '@jitsi/logger'; import MediaDirection from '../../service/RTC/MediaDirection'; import { MediaType } from '../../service/RTC/MediaType'; import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import FeatureFlags from '../flags/FeatureFlags'; import { SdpTransformWrap } from './SdpTransformUtil'; diff --git a/modules/statistics/AvgRTPStatsReporter.js b/modules/statistics/AvgRTPStatsReporter.js index 249e6796d8..f0e00c1687 100644 --- a/modules/statistics/AvgRTPStatsReporter.js +++ b/modules/statistics/AvgRTPStatsReporter.js @@ -3,7 +3,7 @@ import isEqual from 'lodash.isequal'; import * as ConferenceEvents from '../../JitsiConferenceEvents'; import { MediaType } from '../../service/RTC/MediaType'; -import * as VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import * as ConnectionQualityEvents from '../../service/connectivity/ConnectionQualityEvents'; import { diff --git a/modules/xmpp/ChatRoom.js b/modules/xmpp/ChatRoom.js index 865a61fd3c..0cf4e42960 100644 --- a/modules/xmpp/ChatRoom.js +++ b/modules/xmpp/ChatRoom.js @@ -6,7 +6,7 @@ import { $iq, $msg, $pres, Strophe } from 'strophe.js'; import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus'; import { MediaType } from '../../service/RTC/MediaType'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { XMPPEvents } from '../../service/xmpp/XMPPEvents'; import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler'; import Listenable from '../util/Listenable'; diff --git a/modules/xmpp/SignalingLayerImpl.js b/modules/xmpp/SignalingLayerImpl.js index 5d0f223935..77fccc4b93 100644 --- a/modules/xmpp/SignalingLayerImpl.js +++ b/modules/xmpp/SignalingLayerImpl.js @@ -4,7 +4,7 @@ import { Strophe } from 'strophe.js'; import { MediaType } from '../../service/RTC/MediaType'; import * as SignalingEvents from '../../service/RTC/SignalingEvents'; import SignalingLayer, { getMediaTypeFromSourceName } from '../../service/RTC/SignalingLayer'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { XMPPEvents } from '../../service/xmpp/XMPPEvents'; import FeatureFlags from '../flags/FeatureFlags'; diff --git a/modules/xmpp/SignalingLayerImpl.spec.js b/modules/xmpp/SignalingLayerImpl.spec.js index 701487bf2d..c979abc74c 100644 --- a/modules/xmpp/SignalingLayerImpl.spec.js +++ b/modules/xmpp/SignalingLayerImpl.spec.js @@ -1,7 +1,7 @@ import { MediaType } from '../../service/RTC/MediaType'; import * as SignalingEvents from '../../service/RTC/SignalingEvents'; import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer'; -import VideoType from '../../service/RTC/VideoType'; +import { VideoType } from '../../service/RTC/VideoType'; import { XMPPEvents } from '../../service/xmpp/XMPPEvents'; import FeatureFlags from '../flags/FeatureFlags'; import Listenable from '../util/Listenable'; diff --git a/service/RTC/VideoType.spec.ts b/service/RTC/VideoType.spec.ts index 8f643ceff0..042371e53b 100644 --- a/service/RTC/VideoType.spec.ts +++ b/service/RTC/VideoType.spec.ts @@ -4,19 +4,15 @@ import * as exported from "./VideoType"; describe( "/service/RTC/VideoType members", () => { const { - CAMERA, - DESKTOP, VideoType, ...others - } = exported as any; // TODO: remove cast after typescript conversion + } = exported; it( "known members", () => { - expect( CAMERA ).toBe( 'camera' ); - expect( DESKTOP ).toBe( 'desktop' ); - if ( VideoType ) { - expect( VideoType.CAMERA ).toBe( 'camera' ); - expect( VideoType.DESKTOP ).toBe( 'desktop' ); - } + expect( VideoType ).toBeDefined(); + + expect( VideoType.CAMERA ).toBe( 'camera' ); + expect( VideoType.DESKTOP ).toBe( 'desktop' ); } ); it( "unknown members", () => { diff --git a/service/RTC/VideoType.js b/service/RTC/VideoType.ts similarity index 50% rename from service/RTC/VideoType.js rename to service/RTC/VideoType.ts index 1bf9f087c4..9898462294 100644 --- a/service/RTC/VideoType.js +++ b/service/RTC/VideoType.ts @@ -1,17 +1,14 @@ /** * Enumeration of the video types - * @type {{CAMERA: string, DESKTOP: string}} */ -const VideoType = { +export enum VideoType { /** * The camera video type. */ - CAMERA: 'camera', + CAMERA = 'camera', /** * The desktop video type. */ - DESKTOP: 'desktop' + DESKTOP = 'desktop' }; - -module.exports = VideoType; diff --git a/types/auto/modules/RTC/TraceablePeerConnection.d.ts b/types/auto/modules/RTC/TraceablePeerConnection.d.ts index 0d54821288..328d1fe1ec 100644 --- a/types/auto/modules/RTC/TraceablePeerConnection.d.ts +++ b/types/auto/modules/RTC/TraceablePeerConnection.d.ts @@ -386,10 +386,7 @@ export default class TraceablePeerConnection { * @param {boolean} muted the initial muted status * @param {String} sourceName the track's source name */ - _createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: { - CAMERA: string; - DESKTOP: string; - }, ssrc: number, muted: boolean, sourceName: string): void; + _createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: VideoType, ssrc: number, muted: boolean, sourceName: string): void; /** * Handles remote stream removal. * @param stream the WebRTC MediaStream object which is being removed from the @@ -778,3 +775,4 @@ import { TPCUtils } from "./TPCUtils"; import SdpConsistency from "../sdp/SdpConsistency"; import LocalSdpMunger from "../sdp/LocalSdpMunger"; import RtxModifier from "../sdp/RtxModifier"; +import { VideoType } from "../../service/RTC/VideoType"; diff --git a/types/auto/modules/connectivity/ConnectionQuality.d.ts b/types/auto/modules/connectivity/ConnectionQuality.d.ts index 5134749321..6ec645e0e3 100644 --- a/types/auto/modules/connectivity/ConnectionQuality.d.ts +++ b/types/auto/modules/connectivity/ConnectionQuality.d.ts @@ -59,10 +59,7 @@ export default class ConnectionQuality { * @param resolutionName {Resolution} the input resolution used by the camera. * @returns {*} the newly calculated connection quality. */ - _calculateConnectionQuality(videoType: { - CAMERA: string; - DESKTOP: string; - }, isMuted: boolean, resolutionName: any): any; + _calculateConnectionQuality(videoType: VideoType, isMuted: boolean, resolutionName: any): any; /** * Updates the localConnectionQuality value * @param values {number} the new value. Should be in [0, 100]. @@ -95,3 +92,4 @@ export default class ConnectionQuality { jvbRTT: any; }; } +import { VideoType } from "../../service/RTC/VideoType"; diff --git a/types/auto/modules/xmpp/SignalingLayerImpl.d.ts b/types/auto/modules/xmpp/SignalingLayerImpl.d.ts index e5c8b30c11..f836f833b4 100644 --- a/types/auto/modules/xmpp/SignalingLayerImpl.d.ts +++ b/types/auto/modules/xmpp/SignalingLayerImpl.d.ts @@ -102,10 +102,7 @@ export default class SignalingLayerImpl extends SignalingLayer { * @param {VideoType} videoType - the new video type. * @returns {boolean} */ - setTrackVideoType(sourceName: any, videoType: { - CAMERA: string; - DESKTOP: string; - }): boolean; + setTrackVideoType(sourceName: any, videoType: VideoType): boolean; /** * Saves the source name for a track identified by it's ssrc. * @param {number} ssrc the ssrc of the target track. @@ -115,3 +112,4 @@ export default class SignalingLayerImpl extends SignalingLayer { setTrackSourceName(ssrc: number, sourceName: any): void; } import SignalingLayer from "../../service/RTC/SignalingLayer"; +import { VideoType } from "../../service/RTC/VideoType"; diff --git a/types/auto/service/RTC/VideoType.d.ts b/types/auto/service/RTC/VideoType.d.ts index cc9c2b579f..60b3f89023 100644 --- a/types/auto/service/RTC/VideoType.d.ts +++ b/types/auto/service/RTC/VideoType.d.ts @@ -1,9 +1,13 @@ -export = VideoType; /** * Enumeration of the video types - * @type {{CAMERA: string, DESKTOP: string}} */ -declare const VideoType: { - CAMERA: string; - DESKTOP: string; -}; +export declare enum VideoType { + /** + * The camera video type. + */ + CAMERA = "camera", + /** + * The desktop video type. + */ + DESKTOP = "desktop" +}