From 83141073a49fe608081d2acf685bfab684090b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sajn=C3=B3g?= Date: Tue, 9 Aug 2022 12:51:02 +0700 Subject: [PATCH 1/3] Replace 'module' field with 'export' in package.json --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6806aa2d82..20a1862a86 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,10 @@ "watch": "webpack --config webpack.config.js --watch --mode development" }, "browser": "dist/umd/lib-jitsi-meet.min.js", - "module": "dist/esm/JitsiMeetJS.js", + "exports": { + "import": "./dist/esm/JitsiMeetJS.js", + "default": "./dist/umd/lib-jitsi-meet.min.js" + }, "files": [ "dist", "types", From c589b8b656bb153c8688abd36e1ed6487ead0ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sajn=C3=B3g?= Date: Tue, 9 Aug 2022 23:32:36 +0700 Subject: [PATCH 2/3] Specify 'react-native' field instead of 'browser' to properly load ESM module --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20a1862a86..73a2eb622b 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "validate": "npm ls", "watch": "webpack --config webpack.config.js --watch --mode development" }, - "browser": "dist/umd/lib-jitsi-meet.min.js", + "react-native": "./dist/esm/JitsiMeetJS.js", "exports": { "import": "./dist/esm/JitsiMeetJS.js", "default": "./dist/umd/lib-jitsi-meet.min.js" From c7c2912e3156a4ac902e52f64b3edec9d1af01fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sajn=C3=B3g?= Date: Wed, 10 Aug 2022 17:05:47 +0700 Subject: [PATCH 3/3] Fix circular dependency --- modules/RTC/RTC.js | 3 +-- modules/RTC/RTCUtils.js | 13 ++++++++++++- modules/RTC/TraceablePeerConnection.js | 10 +++++----- types/auto/modules/RTC/RTCUtils.d.ts | 11 +++++++++-- types/auto/modules/RTC/TraceablePeerConnection.d.ts | 7 +++---- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index fef1c34be9..9bc57b01ae 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -826,8 +826,7 @@ export default class RTC extends Listenable { * @returns {boolean} */ static isUserStreamById(streamId) { - return streamId && streamId !== 'mixedmslabel' - && streamId !== 'default'; + return RTCUtils.isUserStreamById(streamId); } /** diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index 4146ab1a4d..f05d877399 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -718,7 +718,7 @@ class RTCUtils extends Listenable { /** * Returns true if changing the input (camera / microphone) or output * (audio) device is supported and false if not. - * @params {string} [deviceType] - type of device to change. Default is + * @param {string} [deviceType] - type of device to change. Default is * undefined or 'input', 'output' - for audio output device change. * @returns {boolean} true if available, false otherwise. */ @@ -846,6 +846,17 @@ class RTCUtils extends Listenable { return { deviceList }; } + + + /** + * Returns boolean value indicating whether given stream ID + * indicates user stream or not + * @param {string} [streamId] - ID of a stream + * @returns {boolean} + */ + isUserStreamById(streamId) { + return streamId && streamId !== 'mixedmslabel' && streamId !== 'default'; + } } const rtcUtils = new RTCUtils(); diff --git a/modules/RTC/TraceablePeerConnection.js b/modules/RTC/TraceablePeerConnection.js index c9aed76cac..2a8052ab48 100644 --- a/modules/RTC/TraceablePeerConnection.js +++ b/modules/RTC/TraceablePeerConnection.js @@ -22,7 +22,7 @@ import { SdpTransformWrap } from '../sdp/SdpTransformUtil'; import * as GlobalOnErrorHandler from '../util/GlobalOnErrorHandler'; import JitsiRemoteTrack from './JitsiRemoteTrack'; -import RTC from './RTC'; +import RTCUtils from './RTCUtils'; import { HD_BITRATE, HD_SCALE_FACTOR, @@ -819,7 +819,7 @@ TraceablePeerConnection.prototype.getSsrcByTrackId = function(id) { TraceablePeerConnection.prototype._remoteStreamAdded = function(stream) { const streamId = stream.id; - if (!RTC.isUserStreamById(streamId)) { + if (!RTCUtils.isUserStreamById(streamId)) { logger.info(`${this} ignored remote 'stream added' event for non-user stream[id=${streamId}]`); return; @@ -864,7 +864,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr const streamId = stream.id; const mediaType = track.kind; - if (!this.isP2P && !RTC.isUserStreamById(streamId)) { + if (!this.isP2P && !RTCUtils.isUserStreamById(streamId)) { logger.info(`${this} ignored remote 'stream added' event for non-user stream[id=${streamId}]`); return; @@ -1059,7 +1059,7 @@ TraceablePeerConnection.prototype._createRemoteTrack = function( * PeerConnection */ TraceablePeerConnection.prototype._remoteStreamRemoved = function(stream) { - if (!RTC.isUserStream(stream)) { + if (!RTCUtils.isUserStreamById(stream.id)) { logger.info(`Ignored remote 'stream removed' event for stream[id=${stream.id}]`); return; @@ -1089,7 +1089,7 @@ TraceablePeerConnection.prototype._remoteTrackRemoved = function(stream, track) const streamId = stream.id; const trackId = track?.id; - if (!RTC.isUserStreamById(streamId)) { + if (!RTCUtils.isUserStreamById(streamId)) { logger.info(`${this} ignored remote 'stream removed' event for non-user stream[id=${streamId}]`); return; diff --git a/types/auto/modules/RTC/RTCUtils.d.ts b/types/auto/modules/RTC/RTCUtils.d.ts index 1e2d71afd7..ccc5a95c36 100644 --- a/types/auto/modules/RTC/RTCUtils.d.ts +++ b/types/auto/modules/RTC/RTCUtils.d.ts @@ -93,11 +93,11 @@ declare class RTCUtils extends Listenable { /** * Returns true if changing the input (camera / microphone) or output * (audio) device is supported and false if not. - * @params {string} [deviceType] - type of device to change. Default is + * @param {string} [deviceType] - type of device to change. Default is * undefined or 'input', 'output' - for audio output device change. * @returns {boolean} true if available, false otherwise. */ - isDeviceChangeAvailable(deviceType: any): boolean; + isDeviceChangeAvailable(deviceType?: string): boolean; /** * A method to handle stopping of the stream. * One point to handle the differences in various implementations. @@ -147,5 +147,12 @@ declare class RTCUtils extends Listenable { * @returns {MediaDeviceInfo} device. */ getEventDataForActiveDevice(device: any): MediaDeviceInfo; + /** + * Returns boolean value indicating whether given stream ID + * indicates user stream or not + * @param {string} [streamId] - ID of a stream + * @returns {boolean} + */ + isUserStreamById(streamId?: string): boolean; } import Listenable from "../util/Listenable"; diff --git a/types/auto/modules/RTC/TraceablePeerConnection.d.ts b/types/auto/modules/RTC/TraceablePeerConnection.d.ts index a79fa03d09..77f430cd9b 100644 --- a/types/auto/modules/RTC/TraceablePeerConnection.d.ts +++ b/types/auto/modules/RTC/TraceablePeerConnection.d.ts @@ -23,7 +23,7 @@ * * @constructor */ -export default function TraceablePeerConnection(rtc: RTC, id: number, signalingLayer: any, pcConfig: object, constraints: object, isP2P: boolean, options: { +export default function TraceablePeerConnection(rtc: any, id: number, signalingLayer: any, pcConfig: object, constraints: object, isP2P: boolean, options: { disableSimulcast: boolean; disableRtx: boolean; disabledCodec: string; @@ -57,7 +57,7 @@ export default class TraceablePeerConnection { * * @constructor */ - constructor(rtc: RTC, id: number, signalingLayer: any, pcConfig: object, constraints: object, isP2P: boolean, options: { + constructor(rtc: any, id: number, signalingLayer: any, pcConfig: object, constraints: object, isP2P: boolean, options: { disableSimulcast: boolean; disableRtx: boolean; disabledCodec: string; @@ -112,7 +112,7 @@ export default class TraceablePeerConnection { * TracablePeerConnection. * @type {RTC} */ - rtc: RTC; + rtc: any; /** * The peer connection identifier assigned by the RTC module. * @type {number} @@ -801,7 +801,6 @@ export default class TraceablePeerConnection { */ toString(): string; } -import RTC from "./RTC"; import { MediaType } from "../../service/RTC/MediaType"; import JitsiRemoteTrack from "./JitsiRemoteTrack"; import { TPCUtils } from "./TPCUtils";