浏览代码

typescript conversion of service/RTC/VideoType to named export

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

+ 1
- 1
JitsiConference.js 查看文件

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

+ 1
- 1
JitsiConferenceEventManager.js 查看文件

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6
 
6
 
7
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
7
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
8
 import { MediaType } from '../../service/RTC/MediaType';
8
 import { MediaType } from '../../service/RTC/MediaType';
9
-import VideoType from '../../service/RTC/VideoType';
9
+import { VideoType } from '../../service/RTC/VideoType';
10
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
10
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
11
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
11
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
12
 import Listenable from '../util/Listenable';
12
 import Listenable from '../util/Listenable';

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

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

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

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

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

4
 
4
 
5
 describe( "/service/RTC/VideoType members", () => {
5
 describe( "/service/RTC/VideoType members", () => {
6
     const {
6
     const {
7
-        CAMERA,
8
-        DESKTOP,
9
         VideoType,
7
         VideoType,
10
         ...others
8
         ...others
11
-    } = exported as any; // TODO: remove cast after typescript conversion
9
+    } = exported;
12
 
10
 
13
     it( "known members", () => {
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
     it( "unknown members", () => {
18
     it( "unknown members", () => {

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

1
 /**
1
 /**
2
  * Enumeration of the video types
2
  * Enumeration of the video types
3
- * @type {{CAMERA: string, DESKTOP: string}}
4
  */
3
  */
5
-const VideoType = {
4
+export enum VideoType {
6
     /**
5
     /**
7
      * The camera video type.
6
      * The camera video type.
8
      */
7
      */
9
-    CAMERA: 'camera',
8
+    CAMERA = 'camera',
10
 
9
 
11
     /**
10
     /**
12
      * The desktop video type.
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
      * @param {boolean} muted the initial muted status
386
      * @param {boolean} muted the initial muted status
387
      * @param {String} sourceName the track's source name
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
      * Handles remote stream removal.
391
      * Handles remote stream removal.
395
      * @param stream the WebRTC MediaStream object which is being removed from the
392
      * @param stream the WebRTC MediaStream object which is being removed from the
778
 import SdpConsistency from "../sdp/SdpConsistency";
775
 import SdpConsistency from "../sdp/SdpConsistency";
779
 import LocalSdpMunger from "../sdp/LocalSdpMunger";
776
 import LocalSdpMunger from "../sdp/LocalSdpMunger";
780
 import RtxModifier from "../sdp/RtxModifier";
777
 import RtxModifier from "../sdp/RtxModifier";
778
+import { VideoType } from "../../service/RTC/VideoType";

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

59
      * @param resolutionName {Resolution} the input resolution used by the camera.
59
      * @param resolutionName {Resolution} the input resolution used by the camera.
60
      * @returns {*} the newly calculated connection quality.
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
      * Updates the localConnectionQuality value
64
      * Updates the localConnectionQuality value
68
      * @param values {number} the new value. Should be in [0, 100].
65
      * @param values {number} the new value. Should be in [0, 100].
95
         jvbRTT: any;
92
         jvbRTT: any;
96
     };
93
     };
97
 }
94
 }
95
+import { VideoType } from "../../service/RTC/VideoType";

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

102
      * @param {VideoType} videoType - the new video type.
102
      * @param {VideoType} videoType - the new video type.
103
      * @returns {boolean}
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
      * Saves the source name for a track identified by it's ssrc.
107
      * Saves the source name for a track identified by it's ssrc.
111
      * @param {number} ssrc the ssrc of the target track.
108
      * @param {number} ssrc the ssrc of the target track.
115
     setTrackSourceName(ssrc: number, sourceName: any): void;
112
     setTrackSourceName(ssrc: number, sourceName: any): void;
116
 }
113
 }
117
 import SignalingLayer from "../../service/RTC/SignalingLayer";
114
 import SignalingLayer from "../../service/RTC/SignalingLayer";
115
+import { VideoType } from "../../service/RTC/VideoType";

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

1
-export = VideoType;
2
 /**
1
 /**
3
  * Enumeration of the video types
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
+}

正在加载...
取消
保存