浏览代码

typescript conversion of service/RTC/VideoType to named export

dev1
Gary Hunt 3 年前
父节点
当前提交
90f8d11d00

+ 1
- 1
JitsiConference.js 查看文件

@@ -57,7 +57,7 @@ import CodecMimeType from './service/RTC/CodecMimeType';
57 57
 import { MediaType } from './service/RTC/MediaType';
58 58
 import RTCEvents from './service/RTC/RTCEvents';
59 59
 import { getSourceNameForJitsiTrack } from './service/RTC/SignalingLayer';
60
-import VideoType from './service/RTC/VideoType';
60
+import { VideoType } from './service/RTC/VideoType';
61 61
 import {
62 62
     ACTION_JINGLE_RESTART,
63 63
     ACTION_JINGLE_SI_RECEIVED,

+ 1
- 1
JitsiConferenceEventManager.js 查看文件

@@ -8,7 +8,7 @@ import Statistics from './modules/statistics/statistics';
8 8
 import EventEmitterForwarder from './modules/util/EventEmitterForwarder';
9 9
 import { MediaType } from './service/RTC/MediaType';
10 10
 import RTCEvents from './service/RTC/RTCEvents';
11
-import VideoType from './service/RTC/VideoType';
11
+import { VideoType } from './service/RTC/VideoType';
12 12
 import AuthenticationEvents
13 13
     from './service/authentication/AuthenticationEvents';
14 14
 import {

+ 1
- 1
modules/RTC/JitsiLocalTrack.js 查看文件

@@ -13,7 +13,7 @@ import {
13 13
 import CameraFacingMode from '../../service/RTC/CameraFacingMode';
14 14
 import { MediaType } from '../../service/RTC/MediaType';
15 15
 import RTCEvents from '../../service/RTC/RTCEvents';
16
-import VideoType from '../../service/RTC/VideoType';
16
+import { VideoType } from '../../service/RTC/VideoType';
17 17
 import {
18 18
     NO_BYTES_SENT,
19 19
     TRACK_UNMUTED,

+ 1
- 1
modules/RTC/RTCUtils.js 查看文件

@@ -7,7 +7,7 @@ import * as JitsiTrackErrors from '../../JitsiTrackErrors';
7 7
 import CameraFacingMode from '../../service/RTC/CameraFacingMode';
8 8
 import RTCEvents from '../../service/RTC/RTCEvents';
9 9
 import Resolutions from '../../service/RTC/Resolutions';
10
-import VideoType from '../../service/RTC/VideoType';
10
+import { VideoType } from '../../service/RTC/VideoType';
11 11
 import { AVAILABLE_DEVICE } from '../../service/statistics/AnalyticsEvents';
12 12
 import browser from '../browser';
13 13
 import SDPUtil from '../sdp/SDPUtil';

+ 1
- 1
modules/RTC/TPCUtils.js 查看文件

@@ -3,7 +3,7 @@ import transform from 'sdp-transform';
3 3
 
4 4
 import MediaDirection from '../../service/RTC/MediaDirection';
5 5
 import { MediaType } from '../../service/RTC/MediaType';
6
-import VideoType from '../../service/RTC/VideoType';
6
+import { VideoType } from '../../service/RTC/VideoType';
7 7
 import browser from '../browser';
8 8
 import FeatureFlags from '../flags/FeatureFlags';
9 9
 

+ 1
- 1
modules/RTC/TraceablePeerConnection.js 查看文件

@@ -8,7 +8,7 @@ import { MediaType } from '../../service/RTC/MediaType';
8 8
 import RTCEvents from '../../service/RTC/RTCEvents';
9 9
 import * as SignalingEvents from '../../service/RTC/SignalingEvents';
10 10
 import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
11
-import * as VideoType from '../../service/RTC/VideoType';
11
+import { VideoType } from '../../service/RTC/VideoType';
12 12
 import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
13 13
 import browser from '../browser';
14 14
 import FeatureFlags from '../flags/FeatureFlags';

+ 1
- 1
modules/connectivity/ConnectionQuality.js 查看文件

@@ -7,7 +7,7 @@ import * as ConnectionQualityEvents from '../../service/connectivity/ConnectionQ
7 7
 import browser from '../browser';
8 8
 
9 9
 const Resolutions = require('../../service/RTC/Resolutions');
10
-const VideoType = require('../../service/RTC/VideoType');
10
+const { VideoType } = require('../../service/RTC/VideoType');
11 11
 const { XMPPEvents } = require('../../service/xmpp/XMPPEvents');
12 12
 
13 13
 const logger = getLogger(__filename);

+ 1
- 1
modules/proxyconnection/ProxyConnectionService.js 查看文件

@@ -4,7 +4,7 @@ import { getLogger } from '@jitsi/logger';
4 4
 import { $iq } from 'strophe.js';
5 5
 
6 6
 import { MediaType } from '../../service/RTC/MediaType';
7
-import VideoType from '../../service/RTC/VideoType';
7
+import { VideoType } from '../../service/RTC/VideoType';
8 8
 import RTC from '../RTC/RTC';
9 9
 
10 10
 import ProxyConnectionPC from './ProxyConnectionPC';

+ 1
- 1
modules/sdp/LocalSdpMunger.js 查看文件

@@ -3,7 +3,7 @@ import { getLogger } from '@jitsi/logger';
3 3
 import MediaDirection from '../../service/RTC/MediaDirection';
4 4
 import { MediaType } from '../../service/RTC/MediaType';
5 5
 import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
6
-import VideoType from '../../service/RTC/VideoType';
6
+import { VideoType } from '../../service/RTC/VideoType';
7 7
 import FeatureFlags from '../flags/FeatureFlags';
8 8
 
9 9
 import { SdpTransformWrap } from './SdpTransformUtil';

+ 1
- 1
modules/statistics/AvgRTPStatsReporter.js 查看文件

@@ -3,7 +3,7 @@ import isEqual from 'lodash.isequal';
3 3
 
4 4
 import * as ConferenceEvents from '../../JitsiConferenceEvents';
5 5
 import { MediaType } from '../../service/RTC/MediaType';
6
-import * as VideoType from '../../service/RTC/VideoType';
6
+import { VideoType } from '../../service/RTC/VideoType';
7 7
 import * as ConnectionQualityEvents
8 8
     from '../../service/connectivity/ConnectionQualityEvents';
9 9
 import {

+ 1
- 1
modules/xmpp/ChatRoom.js 查看文件

@@ -6,7 +6,7 @@ import { $iq, $msg, $pres, Strophe } from 'strophe.js';
6 6
 
7 7
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
8 8
 import { MediaType } from '../../service/RTC/MediaType';
9
-import VideoType from '../../service/RTC/VideoType';
9
+import { VideoType } from '../../service/RTC/VideoType';
10 10
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
11 11
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
12 12
 import Listenable from '../util/Listenable';

+ 1
- 1
modules/xmpp/SignalingLayerImpl.js 查看文件

@@ -4,7 +4,7 @@ import { Strophe } from 'strophe.js';
4 4
 import { MediaType } from '../../service/RTC/MediaType';
5 5
 import * as SignalingEvents from '../../service/RTC/SignalingEvents';
6 6
 import SignalingLayer, { getMediaTypeFromSourceName } from '../../service/RTC/SignalingLayer';
7
-import VideoType from '../../service/RTC/VideoType';
7
+import { VideoType } from '../../service/RTC/VideoType';
8 8
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
9 9
 import FeatureFlags from '../flags/FeatureFlags';
10 10
 

+ 1
- 1
modules/xmpp/SignalingLayerImpl.spec.js 查看文件

@@ -1,7 +1,7 @@
1 1
 import { MediaType } from '../../service/RTC/MediaType';
2 2
 import * as SignalingEvents from '../../service/RTC/SignalingEvents';
3 3
 import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
4
-import VideoType from '../../service/RTC/VideoType';
4
+import { VideoType } from '../../service/RTC/VideoType';
5 5
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
6 6
 import FeatureFlags from '../flags/FeatureFlags';
7 7
 import Listenable from '../util/Listenable';

+ 5
- 9
service/RTC/VideoType.spec.ts 查看文件

@@ -4,19 +4,15 @@ import * as exported from "./VideoType";
4 4
 
5 5
 describe( "/service/RTC/VideoType members", () => {
6 6
     const {
7
-        CAMERA,
8
-        DESKTOP,
9 7
         VideoType,
10 8
         ...others
11
-    } = exported as any; // TODO: remove cast after typescript conversion
9
+    } = exported;
12 10
 
13 11
     it( "known members", () => {
14
-        expect( CAMERA ).toBe( 'camera' );
15
-        expect( DESKTOP ).toBe( 'desktop' );
16
-        if ( VideoType ) {
17
-            expect( VideoType.CAMERA ).toBe( 'camera' );
18
-            expect( VideoType.DESKTOP ).toBe( 'desktop' );
19
-        }
12
+        expect( VideoType ).toBeDefined();
13
+
14
+        expect( VideoType.CAMERA ).toBe( 'camera' );
15
+        expect( VideoType.DESKTOP ).toBe( 'desktop' );
20 16
     } );
21 17
 
22 18
     it( "unknown members", () => {

service/RTC/VideoType.js → service/RTC/VideoType.ts 查看文件

@@ -1,17 +1,14 @@
1 1
 /**
2 2
  * Enumeration of the video types
3
- * @type {{CAMERA: string, DESKTOP: string}}
4 3
  */
5
-const VideoType = {
4
+export enum VideoType {
6 5
     /**
7 6
      * The camera video type.
8 7
      */
9
-    CAMERA: 'camera',
8
+    CAMERA = 'camera',
10 9
 
11 10
     /**
12 11
      * The desktop video type.
13 12
      */
14
-    DESKTOP: 'desktop'
13
+    DESKTOP = 'desktop'
15 14
 };
16
-
17
-module.exports = VideoType;

+ 2
- 4
types/auto/modules/RTC/TraceablePeerConnection.d.ts 查看文件

@@ -386,10 +386,7 @@ export default class TraceablePeerConnection {
386 386
      * @param {boolean} muted the initial muted status
387 387
      * @param {String} sourceName the track's source name
388 388
      */
389
-    _createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: {
390
-        CAMERA: string;
391
-        DESKTOP: string;
392
-    }, ssrc: number, muted: boolean, sourceName: string): void;
389
+    _createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: VideoType, ssrc: number, muted: boolean, sourceName: string): void;
393 390
     /**
394 391
      * Handles remote stream removal.
395 392
      * @param stream the WebRTC MediaStream object which is being removed from the
@@ -778,3 +775,4 @@ import { TPCUtils } from "./TPCUtils";
778 775
 import SdpConsistency from "../sdp/SdpConsistency";
779 776
 import LocalSdpMunger from "../sdp/LocalSdpMunger";
780 777
 import RtxModifier from "../sdp/RtxModifier";
778
+import { VideoType } from "../../service/RTC/VideoType";

+ 2
- 4
types/auto/modules/connectivity/ConnectionQuality.d.ts 查看文件

@@ -59,10 +59,7 @@ export default class ConnectionQuality {
59 59
      * @param resolutionName {Resolution} the input resolution used by the camera.
60 60
      * @returns {*} the newly calculated connection quality.
61 61
      */
62
-    _calculateConnectionQuality(videoType: {
63
-        CAMERA: string;
64
-        DESKTOP: string;
65
-    }, isMuted: boolean, resolutionName: any): any;
62
+    _calculateConnectionQuality(videoType: VideoType, isMuted: boolean, resolutionName: any): any;
66 63
     /**
67 64
      * Updates the localConnectionQuality value
68 65
      * @param values {number} the new value. Should be in [0, 100].
@@ -95,3 +92,4 @@ export default class ConnectionQuality {
95 92
         jvbRTT: any;
96 93
     };
97 94
 }
95
+import { VideoType } from "../../service/RTC/VideoType";

+ 2
- 4
types/auto/modules/xmpp/SignalingLayerImpl.d.ts 查看文件

@@ -102,10 +102,7 @@ export default class SignalingLayerImpl extends SignalingLayer {
102 102
      * @param {VideoType} videoType - the new video type.
103 103
      * @returns {boolean}
104 104
      */
105
-    setTrackVideoType(sourceName: any, videoType: {
106
-        CAMERA: string;
107
-        DESKTOP: string;
108
-    }): boolean;
105
+    setTrackVideoType(sourceName: any, videoType: VideoType): boolean;
109 106
     /**
110 107
      * Saves the source name for a track identified by it's ssrc.
111 108
      * @param {number} ssrc the ssrc of the target track.
@@ -115,3 +112,4 @@ export default class SignalingLayerImpl extends SignalingLayer {
115 112
     setTrackSourceName(ssrc: number, sourceName: any): void;
116 113
 }
117 114
 import SignalingLayer from "../../service/RTC/SignalingLayer";
115
+import { VideoType } from "../../service/RTC/VideoType";

+ 10
- 6
types/auto/service/RTC/VideoType.d.ts 查看文件

@@ -1,9 +1,13 @@
1
-export = VideoType;
2 1
 /**
3 2
  * Enumeration of the video types
4
- * @type {{CAMERA: string, DESKTOP: string}}
5 3
  */
6
-declare const VideoType: {
7
-    CAMERA: string;
8
-    DESKTOP: string;
9
-};
4
+export declare enum VideoType {
5
+    /**
6
+     * The camera video type.
7
+     */
8
+    CAMERA = "camera",
9
+    /**
10
+     * The desktop video type.
11
+     */
12
+    DESKTOP = "desktop"
13
+}

正在加载...
取消
保存