@whereby.com/media 11.4.1 → 11.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +0 -79
- package/dist/index.d.cts +180 -14
- package/dist/index.d.mts +180 -14
- package/dist/index.d.ts +180 -14
- package/dist/index.mjs +0 -79
- package/dist/legacy-esm.js +0 -79
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -524,6 +524,12 @@ interface RtcManager {
|
|
|
524
524
|
rtcStatsDisconnect(): void;
|
|
525
525
|
rtcStatsReconnect(): void;
|
|
526
526
|
replaceTrack(oldTrack: MediaStreamTrack | null, newTrack: MediaStreamTrack): void;
|
|
527
|
+
stopOrResumeAudio({ enable }: {
|
|
528
|
+
enable: boolean;
|
|
529
|
+
}): void;
|
|
530
|
+
stopOrResumeVideo({ enable }: {
|
|
531
|
+
enable: boolean;
|
|
532
|
+
}): void;
|
|
527
533
|
shouldAcceptStreamsFromBothSides: () => boolean;
|
|
528
534
|
updateStreamResolution(streamId: string, ignored: null, resolution: {
|
|
529
535
|
width: number;
|
|
@@ -773,6 +779,9 @@ declare class KeepAliveManager {
|
|
|
773
779
|
private onReconnectAttempt;
|
|
774
780
|
}
|
|
775
781
|
|
|
782
|
+
/**
|
|
783
|
+
* Wrapper class that extends the Socket.IO client library.
|
|
784
|
+
*/
|
|
776
785
|
declare class ServerSocket {
|
|
777
786
|
_socket: any;
|
|
778
787
|
_reconnectManager?: ReconnectManager | null;
|
|
@@ -799,10 +808,32 @@ declare class ServerSocket {
|
|
|
799
808
|
getManager(): any;
|
|
800
809
|
isConnecting(): any;
|
|
801
810
|
isConnected(): any;
|
|
811
|
+
/**
|
|
812
|
+
* Register a new event handler.
|
|
813
|
+
*
|
|
814
|
+
* @param {string} eventName - Name of the event to listen for.
|
|
815
|
+
* @param {function} handler - The callback function that should be called for the event.
|
|
816
|
+
* @returns {function} Function to deregister the listener.
|
|
817
|
+
*/
|
|
802
818
|
on(eventName: string, handler: Function): () => void;
|
|
803
819
|
onEngineEvent(eventName: string, handler: Function): () => void;
|
|
820
|
+
/**
|
|
821
|
+
* Register a new event handler to be triggered only once.
|
|
822
|
+
*
|
|
823
|
+
* @param {string} eventName - Name of the event to listen for.
|
|
824
|
+
* @param {function} handler - The function that should be called for the event.
|
|
825
|
+
*/
|
|
804
826
|
once(eventName: string, handler: Function): void;
|
|
827
|
+
/**
|
|
828
|
+
* Deregister an event handler.
|
|
829
|
+
*
|
|
830
|
+
* @param {string} eventName - Name of the event the handler is registered for.
|
|
831
|
+
* @param {function} handler - The callback that will be deregistered.
|
|
832
|
+
*/
|
|
805
833
|
off(eventName: string, handler: Function): void;
|
|
834
|
+
/**
|
|
835
|
+
* Intercept event and let ReconnectManager handle them.
|
|
836
|
+
*/
|
|
806
837
|
_interceptEvent(eventName: string, handler: any): () => void;
|
|
807
838
|
getGlitchFreeMetrics(): {
|
|
808
839
|
roomJoinedLate: number;
|
|
@@ -1408,6 +1439,10 @@ interface SignalRequests {
|
|
|
1408
1439
|
}
|
|
1409
1440
|
type TurnTransportProtocol = "onlyudp" | "onlytcp" | "onlytls";
|
|
1410
1441
|
|
|
1442
|
+
/**
|
|
1443
|
+
* @param {Location} location - the location object to use to resolve branding information.
|
|
1444
|
+
* @return {Object} urls - urls created from this location
|
|
1445
|
+
*/
|
|
1411
1446
|
declare function fromLocation({ host, protocol }?: {
|
|
1412
1447
|
host?: string | undefined;
|
|
1413
1448
|
protocol?: string | undefined;
|
|
@@ -1478,7 +1513,13 @@ declare const CONGESTED_RTT_INFLATION_MS = 100;
|
|
|
1478
1513
|
declare const CONGESTED_FRACTION_LOST = 0.02;
|
|
1479
1514
|
declare const CAM_SAMPLES_SKIPPED_AFTER_CANDIDATE_PAIR_CHANGE = 2;
|
|
1480
1515
|
|
|
1516
|
+
/**
|
|
1517
|
+
* Low level constraints helper, creates the actual object used for GUM constraints
|
|
1518
|
+
*/
|
|
1481
1519
|
declare function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, preferredDeviceIds, resolution, simulcast, widescreen, }: GetMediaConstraintsOptions): any;
|
|
1520
|
+
/**
|
|
1521
|
+
* High level mediaConstraints helper
|
|
1522
|
+
*/
|
|
1482
1523
|
declare function getConstraints({ devices, videoId, audioId, options, type }: GetConstraintsOptions): any;
|
|
1483
1524
|
|
|
1484
1525
|
declare const isMobile: boolean;
|
|
@@ -1494,7 +1535,15 @@ declare function buildDeviceList({ busyDeviceIds, devices, kind }: BuildDeviceLi
|
|
|
1494
1535
|
[x: string]: string;
|
|
1495
1536
|
label: string;
|
|
1496
1537
|
}[];
|
|
1538
|
+
/**
|
|
1539
|
+
* Basically just wrapping getUserMedia
|
|
1540
|
+
*/
|
|
1497
1541
|
declare function getUserMedia(constraints: any): Promise<MediaStream>;
|
|
1542
|
+
/**
|
|
1543
|
+
* Gets audio and video device data from stream
|
|
1544
|
+
*
|
|
1545
|
+
* @returns {{video: {deviceId}, audio: {deviceId}}} - the ids are null if not found
|
|
1546
|
+
*/
|
|
1498
1547
|
declare function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, lastVideoId, }: {
|
|
1499
1548
|
audioTrack?: MediaStreamTrack | null;
|
|
1500
1549
|
videoTrack?: MediaStreamTrack | null;
|
|
@@ -1502,11 +1551,31 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, lastAudioId, l
|
|
|
1502
1551
|
lastAudioId?: string | undefined;
|
|
1503
1552
|
lastVideoId?: string | undefined;
|
|
1504
1553
|
}): GetDeviceDataResult;
|
|
1554
|
+
/**
|
|
1555
|
+
* Stops all tracks in a media stream.
|
|
1556
|
+
*/
|
|
1505
1557
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
1558
|
+
/**
|
|
1559
|
+
* Replaces tracks in stream with tracks from newStream
|
|
1560
|
+
*/
|
|
1506
1561
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
1507
1562
|
declare function getInitialStream(constraintOpt: GetInitialStreamOptions): Promise<GetStreamResult>;
|
|
1563
|
+
/**
|
|
1564
|
+
* Gets stream or replace tracks in with some fallbacks
|
|
1565
|
+
*
|
|
1566
|
+
* @param constraintOpt - for mediaConstraints.getConstraints (audioId/videoId etc)
|
|
1567
|
+
* @param options.replaceStream - stream to put new tracks into (instead of returning fresh)
|
|
1568
|
+
* @param options.fallback - try to give working stream
|
|
1569
|
+
* @returns {Promise<{stream, error=null, attempts}>}
|
|
1570
|
+
*/
|
|
1508
1571
|
declare function getStream(constraintOpt: GetConstraintsOptions, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
1509
1572
|
declare function hasGetDisplayMedia(): boolean;
|
|
1573
|
+
/**
|
|
1574
|
+
* Gets the display
|
|
1575
|
+
*
|
|
1576
|
+
* @param {Object} [constraints={ video: true }] constraints - MediaStreamConstraints
|
|
1577
|
+
* @returns {Promise<MediaStream>}
|
|
1578
|
+
*/
|
|
1510
1579
|
declare function getDisplayMedia(constraints?: DisplayMediaStreamOptions, contentHint?: string): Promise<MediaStream>;
|
|
1511
1580
|
declare function compareLocalDevices(before: MediaDeviceInfo[], after: MediaDeviceInfo[]): Record<MediaDeviceKind, {
|
|
1512
1581
|
removed: Record<string, MediaDeviceInfo>;
|
|
@@ -1782,7 +1851,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1782
1851
|
_screenshareVideoTrackIds: string[];
|
|
1783
1852
|
_remoteClientMediaPrefs: Record<string, MediaPrefs>;
|
|
1784
1853
|
_socketListenerDeregisterFunctions: any[];
|
|
1785
|
-
_localStreamDeregisterFunction: any;
|
|
1786
1854
|
_emitter: any;
|
|
1787
1855
|
_serverSocket: ServerSocket;
|
|
1788
1856
|
_webrtcProvider: WebRTCProvider;
|
|
@@ -1799,7 +1867,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1799
1867
|
_mediaserverConfigTtlSeconds: any;
|
|
1800
1868
|
_fetchMediaServersTimer: ClearableTimeout | null;
|
|
1801
1869
|
_icePublicIPGatheringTimeoutID: ClearableTimeout | null;
|
|
1802
|
-
_stoppedVideoTrack?: MediaStreamTrack;
|
|
1803
1870
|
_videoTrackBeingMonitored?: MediaStreamTrack;
|
|
1804
1871
|
_audioTrackBeingMonitored?: MediaStreamTrack;
|
|
1805
1872
|
_closed: boolean;
|
|
@@ -1814,7 +1881,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1814
1881
|
isSfu: boolean;
|
|
1815
1882
|
}): boolean;
|
|
1816
1883
|
addCameraStream(stream: MediaStream, { beforeEffectTracks }?: AddCameraStreamOptions): void;
|
|
1817
|
-
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
1818
1884
|
addScreenshareStream(stream: MediaStream): void;
|
|
1819
1885
|
replaceTrack(oldTrack: MediaStreamTrack | null, newTrack: MediaStreamTrack): Promise<void | any[]>;
|
|
1820
1886
|
close(): void;
|
|
@@ -1838,19 +1904,25 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1838
1904
|
_cleanup(clientId: string): void;
|
|
1839
1905
|
_forEachPeerConnection(func: any): void;
|
|
1840
1906
|
_addStreamToPeerConnections(stream: MediaStream): void;
|
|
1841
|
-
_addTrackToPeerConnections(track: MediaStreamTrack): void;
|
|
1842
1907
|
_replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<void | any[]>;
|
|
1843
1908
|
_removeStreamFromPeerConnections(stream: MediaStream): void;
|
|
1844
1909
|
_updateAndScheduleMediaServersRefresh({ iceServers, turnServers, mediaserverConfigTtlSeconds, }: SignalMediaServerConfig): void;
|
|
1845
1910
|
_clearMediaServersRefresh(): void;
|
|
1846
1911
|
_monitorAudioTrack(track: MediaStreamTrack): void;
|
|
1847
1912
|
_monitorVideoTrack(track: MediaStreamTrack): void;
|
|
1913
|
+
/**
|
|
1914
|
+
* This function should only be called as a response to READY_TO_RECEIVE_OFFER.
|
|
1915
|
+
* It is the starting point of our P2P negotiation and creates the initial offer.
|
|
1916
|
+
*/
|
|
1848
1917
|
_connect(clientId: string): Session;
|
|
1849
1918
|
_maybeRestartIce(clientId: string, session: Session): void;
|
|
1850
1919
|
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
1851
1920
|
_negotiatePeerConnection({ clientId, session, constraints, isInitialOffer, }: NegotiatePeerConnectionOptions): void;
|
|
1852
1921
|
_withForcedRenegotiation(session: Session, action: any): void;
|
|
1853
1922
|
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
1923
|
+
/**
|
|
1924
|
+
* Possibly start a new peer connection for the new stream if needed.
|
|
1925
|
+
*/
|
|
1854
1926
|
acceptNewStream({ streamId, clientId }: {
|
|
1855
1927
|
streamId: string;
|
|
1856
1928
|
clientId: string;
|
|
@@ -1861,10 +1933,6 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
1861
1933
|
height: number;
|
|
1862
1934
|
}): void;
|
|
1863
1935
|
stopOrResumeAudio(): void;
|
|
1864
|
-
_handleStopOrResumeVideo({ enable, track }: {
|
|
1865
|
-
enable: boolean;
|
|
1866
|
-
track: MediaStreamTrack;
|
|
1867
|
-
}): void;
|
|
1868
1936
|
stopOrResumeVideo(): void;
|
|
1869
1937
|
removeScreenshareStream(stream: MediaStream, { requestedByClientId }?: RemoveScreenshareStreamOptions): void;
|
|
1870
1938
|
hasClient(clientId: string): boolean;
|
|
@@ -2018,6 +2086,15 @@ declare class KalmanFilter {
|
|
|
2018
2086
|
B: number;
|
|
2019
2087
|
cov: number;
|
|
2020
2088
|
x: number;
|
|
2089
|
+
/**
|
|
2090
|
+
* Create 1-dimensional kalman filter
|
|
2091
|
+
* @param {Number} options.R Process noise
|
|
2092
|
+
* @param {Number} options.Q Measurement noise
|
|
2093
|
+
* @param {Number} options.A State vector
|
|
2094
|
+
* @param {Number} options.B Control vector
|
|
2095
|
+
* @param {Number} options.C Measurement vector
|
|
2096
|
+
* @return {KalmanFilter}
|
|
2097
|
+
*/
|
|
2021
2098
|
constructor({ R, Q, A, B, C }?: {
|
|
2022
2099
|
R?: number;
|
|
2023
2100
|
Q?: number;
|
|
@@ -2025,11 +2102,38 @@ declare class KalmanFilter {
|
|
|
2025
2102
|
B?: number;
|
|
2026
2103
|
C?: number;
|
|
2027
2104
|
});
|
|
2105
|
+
/**
|
|
2106
|
+
* Filter a new value
|
|
2107
|
+
* @param {Number} z Measurement
|
|
2108
|
+
* @param {Number} u Control
|
|
2109
|
+
* @return {Number}
|
|
2110
|
+
*/
|
|
2028
2111
|
filter(z: number, u?: number): number;
|
|
2112
|
+
/**
|
|
2113
|
+
* Predict next value
|
|
2114
|
+
* @param {Number} [u] Control
|
|
2115
|
+
* @return {Number}
|
|
2116
|
+
*/
|
|
2029
2117
|
predict(u?: number): number;
|
|
2118
|
+
/**
|
|
2119
|
+
* Return uncertainty of filter
|
|
2120
|
+
* @return {Number}
|
|
2121
|
+
*/
|
|
2030
2122
|
uncertainty(): number;
|
|
2123
|
+
/**
|
|
2124
|
+
* Return the last filtered measurement
|
|
2125
|
+
* @return {Number}
|
|
2126
|
+
*/
|
|
2031
2127
|
lastMeasurement(): number;
|
|
2128
|
+
/**
|
|
2129
|
+
* Set measurement noise Q
|
|
2130
|
+
* @param {Number} noise
|
|
2131
|
+
*/
|
|
2032
2132
|
setMeasurementNoise(noise: number): void;
|
|
2133
|
+
/**
|
|
2134
|
+
* Set the process noise R
|
|
2135
|
+
* @param {Number} noise
|
|
2136
|
+
*/
|
|
2033
2137
|
setProcessNoise(noise: number): void;
|
|
2034
2138
|
}
|
|
2035
2139
|
declare const createACFCalculator: () => (arr: any[]) => number;
|
|
@@ -2111,7 +2215,6 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2111
2215
|
}>;
|
|
2112
2216
|
_consumers: any;
|
|
2113
2217
|
_dataConsumers: any;
|
|
2114
|
-
_localStreamDeregisterFunction: any;
|
|
2115
2218
|
_micTrack: any;
|
|
2116
2219
|
_webcamTrack: any;
|
|
2117
2220
|
_screenVideoTrack: any;
|
|
@@ -2218,40 +2321,103 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2218
2321
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
2219
2322
|
_stopProducer(producer: Producer): void;
|
|
2220
2323
|
_getAreTooManyAlreadyPresenting(): boolean;
|
|
2324
|
+
/**
|
|
2325
|
+
* This is called from the RTCDispatcher when the signal socket reconnects to
|
|
2326
|
+
* verify that the RTCManager is still valid.
|
|
2327
|
+
*
|
|
2328
|
+
* @param {{
|
|
2329
|
+
* selfId: string,
|
|
2330
|
+
* roomName: string,
|
|
2331
|
+
* isSfu: boolean,
|
|
2332
|
+
* }} options
|
|
2333
|
+
* @returns {boolean}
|
|
2334
|
+
*/
|
|
2221
2335
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
2222
2336
|
selfId: string;
|
|
2223
2337
|
roomName: string;
|
|
2224
2338
|
isSfu: boolean;
|
|
2225
2339
|
}): boolean;
|
|
2340
|
+
/**
|
|
2341
|
+
* This gets called from the RTCDispatcher when the signal socket reconnects.
|
|
2342
|
+
*
|
|
2343
|
+
* @param {string} eventClaim
|
|
2344
|
+
*/
|
|
2226
2345
|
setEventClaim(eventClaim: string): void;
|
|
2346
|
+
/**
|
|
2347
|
+
* This gets called when the user joins a colocation group, where the group is
|
|
2348
|
+
* the string identified for the group that is shared between the users.
|
|
2349
|
+
*
|
|
2350
|
+
* @param {string} colocation
|
|
2351
|
+
*/
|
|
2227
2352
|
setColocation(colocation: any): void;
|
|
2353
|
+
/**
|
|
2354
|
+
* This sends a signal to the SFU to pause all incoming video streams to the client.
|
|
2355
|
+
*
|
|
2356
|
+
* @param {boolean} audioOnly
|
|
2357
|
+
*/
|
|
2228
2358
|
setAudioOnly(audioOnly: boolean): void;
|
|
2229
2359
|
setRemoteScreenshareVideoTrackIds(): void;
|
|
2230
2360
|
setRemoteClientMediaPrefs(): void;
|
|
2231
2361
|
removeRemoteClientMediaPrefs(): void;
|
|
2362
|
+
/**
|
|
2363
|
+
* The unique identifier for this room session.
|
|
2364
|
+
*
|
|
2365
|
+
* @param {string} roomSessionId
|
|
2366
|
+
*/
|
|
2232
2367
|
setRoomSessionId(roomSessionId: string): void;
|
|
2368
|
+
/**
|
|
2369
|
+
* The eventClaim is only used for SFU meetings.
|
|
2370
|
+
* It must be sent to the SFU to ensure that the SFU knows that the client has left.
|
|
2371
|
+
*
|
|
2372
|
+
* @param {string} clientId
|
|
2373
|
+
* @param {string} eventClaim
|
|
2374
|
+
*/
|
|
2233
2375
|
disconnect(clientId: string, eventClaim?: string): void;
|
|
2234
2376
|
replaceTrack(_: MediaStreamTrack | null, track: MediaStreamTrack): void;
|
|
2235
2377
|
removeScreenshareStream(stream: MediaStream, { requestedByClientId }?: RemoveScreenshareStreamOptions): void;
|
|
2236
2378
|
_onMicAnalyserScoreUpdated(data: any): void;
|
|
2237
2379
|
addCameraStream(stream: MediaStream, { audioPaused, videoPaused, beforeEffectTracks }?: AddCameraStreamOptions): void;
|
|
2238
|
-
_enableStopResumeVideoForBrowserSDK(stream: MediaStream): void;
|
|
2239
2380
|
addScreenshareStream(stream: MediaStream): void;
|
|
2240
2381
|
_syncMicAnalyser(): void;
|
|
2382
|
+
/**
|
|
2383
|
+
* Only for mic.
|
|
2384
|
+
*
|
|
2385
|
+
* The consuming app toggled the microphone.
|
|
2386
|
+
*/
|
|
2241
2387
|
stopOrResumeAudio({ enable }: {
|
|
2242
2388
|
enable: boolean;
|
|
2243
2389
|
}): void;
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2390
|
+
/**
|
|
2391
|
+
* Only for webcam. The consuming app toggled the webcam. Camera tracks arrive
|
|
2392
|
+
* through replaceTrack, whenever the app has one.
|
|
2393
|
+
*/
|
|
2248
2394
|
stopOrResumeVideo({ enable }: {
|
|
2249
2395
|
enable: boolean;
|
|
2250
2396
|
}): void;
|
|
2397
|
+
/**
|
|
2398
|
+
* If the streamId and clientId are the same, this is a webcam/mic stream.
|
|
2399
|
+
* Otherwise, this is a screen share stream.
|
|
2400
|
+
*
|
|
2401
|
+
* @param {{
|
|
2402
|
+
* streamId: string,
|
|
2403
|
+
* clientId: string,
|
|
2404
|
+
* }} streamOptions
|
|
2405
|
+
*/
|
|
2251
2406
|
acceptNewStream({ streamId, clientId }: {
|
|
2252
2407
|
streamId: string;
|
|
2253
2408
|
clientId: string;
|
|
2254
2409
|
}): void;
|
|
2410
|
+
/**
|
|
2411
|
+
* This is called when the user resizes their window such that we neee to
|
|
2412
|
+
* update the consumer layers.
|
|
2413
|
+
*
|
|
2414
|
+
* @param {string} streamId
|
|
2415
|
+
* @param {ignored} _ignored
|
|
2416
|
+
* @param {{
|
|
2417
|
+
* width: number,
|
|
2418
|
+
* height: number,
|
|
2419
|
+
* }} size
|
|
2420
|
+
*/
|
|
2255
2421
|
updateStreamResolution(streamId: string, _ignored: any, { width, height, }: {
|
|
2256
2422
|
width: number;
|
|
2257
2423
|
height: number;
|
package/dist/index.mjs
CHANGED
|
@@ -2490,7 +2490,6 @@ class P2pRtcManager {
|
|
|
2490
2490
|
this.peerConnections = {};
|
|
2491
2491
|
this._screenshareVideoTrackIds = [];
|
|
2492
2492
|
this._socketListenerDeregisterFunctions = [];
|
|
2493
|
-
this._localStreamDeregisterFunction = null;
|
|
2494
2493
|
this._emitter = emitter;
|
|
2495
2494
|
this._serverSocket = serverSocket;
|
|
2496
2495
|
this._webrtcProvider = webrtcProvider;
|
|
@@ -2576,21 +2575,6 @@ class P2pRtcManager {
|
|
|
2576
2575
|
this._monitorVideoTrack(beforeEffectTrack);
|
|
2577
2576
|
}
|
|
2578
2577
|
}
|
|
2579
|
-
this._enableStopResumeVideoForBrowserSDK(stream);
|
|
2580
|
-
}
|
|
2581
|
-
_enableStopResumeVideoForBrowserSDK(stream) {
|
|
2582
|
-
if (this._localStreamDeregisterFunction) {
|
|
2583
|
-
this._localStreamDeregisterFunction();
|
|
2584
|
-
this._localStreamDeregisterFunction = null;
|
|
2585
|
-
}
|
|
2586
|
-
const localStreamHandler = (e) => {
|
|
2587
|
-
const { enable, track } = e.detail;
|
|
2588
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
2589
|
-
};
|
|
2590
|
-
stream.addEventListener("stopresumevideo", localStreamHandler);
|
|
2591
|
-
this._localStreamDeregisterFunction = () => {
|
|
2592
|
-
stream.removeEventListener("stopresumevideo", localStreamHandler);
|
|
2593
|
-
};
|
|
2594
2578
|
}
|
|
2595
2579
|
addScreenshareStream(stream) {
|
|
2596
2580
|
logger$7.info("addScreenshareStream() [stream.id: %s]", stream.id);
|
|
@@ -2629,10 +2613,6 @@ class P2pRtcManager {
|
|
|
2629
2613
|
func();
|
|
2630
2614
|
});
|
|
2631
2615
|
this._socketListenerDeregisterFunctions = [];
|
|
2632
|
-
if (this._localStreamDeregisterFunction) {
|
|
2633
|
-
this._localStreamDeregisterFunction();
|
|
2634
|
-
this._localStreamDeregisterFunction = null;
|
|
2635
|
-
}
|
|
2636
2616
|
this.rtcStatsDisconnect();
|
|
2637
2617
|
}
|
|
2638
2618
|
setupSocketListeners() {
|
|
@@ -3081,9 +3061,6 @@ class P2pRtcManager {
|
|
|
3081
3061
|
if (this._features.increaseIncomingMediaBufferOn) {
|
|
3082
3062
|
this._setJitterBufferTarget(pc);
|
|
3083
3063
|
}
|
|
3084
|
-
if (this._localCameraStream && !this._localCameraStream.getVideoTracks().length && this._stoppedVideoTrack) {
|
|
3085
|
-
pc.addTrack(this._stoppedVideoTrack, this._localCameraStream);
|
|
3086
|
-
}
|
|
3087
3064
|
return session;
|
|
3088
3065
|
}
|
|
3089
3066
|
_cleanup(clientId) {
|
|
@@ -3106,11 +3083,6 @@ class P2pRtcManager {
|
|
|
3106
3083
|
this._withForcedRenegotiation(session, () => session.addStream(stream));
|
|
3107
3084
|
});
|
|
3108
3085
|
}
|
|
3109
|
-
_addTrackToPeerConnections(track) {
|
|
3110
|
-
this._forEachPeerConnection((session) => {
|
|
3111
|
-
this._withForcedRenegotiation(session, () => session.addTrack(track));
|
|
3112
|
-
});
|
|
3113
|
-
}
|
|
3114
3086
|
_replaceTrackToPeerConnections(oldTrack, newTrack) {
|
|
3115
3087
|
const promises = [];
|
|
3116
3088
|
this._forEachPeerConnection((session) => {
|
|
@@ -3396,20 +3368,6 @@ class P2pRtcManager {
|
|
|
3396
3368
|
}
|
|
3397
3369
|
stopOrResumeAudio() {
|
|
3398
3370
|
}
|
|
3399
|
-
_handleStopOrResumeVideo({ enable, track }) {
|
|
3400
|
-
if (!enable) {
|
|
3401
|
-
this._stoppedVideoTrack = track;
|
|
3402
|
-
}
|
|
3403
|
-
else {
|
|
3404
|
-
if (this._stoppedVideoTrack) {
|
|
3405
|
-
this._replaceTrackToPeerConnections(this._stoppedVideoTrack, track);
|
|
3406
|
-
delete this._stoppedVideoTrack;
|
|
3407
|
-
}
|
|
3408
|
-
else {
|
|
3409
|
-
this._addTrackToPeerConnections(track);
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
}
|
|
3413
3371
|
stopOrResumeVideo() {
|
|
3414
3372
|
}
|
|
3415
3373
|
removeScreenshareStream(stream, { requestedByClientId } = {}) {
|
|
@@ -4381,7 +4339,6 @@ class VegaRtcManager {
|
|
|
4381
4339
|
this._streamIdToVideoResolution = new Map();
|
|
4382
4340
|
this._consumers = new Map();
|
|
4383
4341
|
this._dataConsumers = new Map();
|
|
4384
|
-
this._localStreamDeregisterFunction = null;
|
|
4385
4342
|
this._micTrack = null;
|
|
4386
4343
|
this._webcamTrack = null;
|
|
4387
4344
|
this._screenVideoTrack = null;
|
|
@@ -5521,23 +5478,6 @@ class VegaRtcManager {
|
|
|
5521
5478
|
this._monitorAudioTrack(beforeEffectTrack);
|
|
5522
5479
|
}
|
|
5523
5480
|
}
|
|
5524
|
-
this._enableStopResumeVideoForBrowserSDK(stream);
|
|
5525
|
-
}
|
|
5526
|
-
_enableStopResumeVideoForBrowserSDK(stream) {
|
|
5527
|
-
if (this._localStreamDeregisterFunction) {
|
|
5528
|
-
this._localStreamDeregisterFunction();
|
|
5529
|
-
this._localStreamDeregisterFunction = null;
|
|
5530
|
-
}
|
|
5531
|
-
const localStreamHandler = (e) => {
|
|
5532
|
-
const { enable, track } = e.detail;
|
|
5533
|
-
this._webcamPaused = !enable;
|
|
5534
|
-
this._pauseResumeWebcam();
|
|
5535
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
5536
|
-
};
|
|
5537
|
-
stream.addEventListener("stopresumevideo", localStreamHandler);
|
|
5538
|
-
this._localStreamDeregisterFunction = () => {
|
|
5539
|
-
stream.removeEventListener("stopresumevideo", localStreamHandler);
|
|
5540
|
-
};
|
|
5541
5481
|
}
|
|
5542
5482
|
addScreenshareStream(stream) {
|
|
5543
5483
|
const videoTrack = stream.getVideoTracks()[0];
|
|
@@ -5567,21 +5507,6 @@ class VegaRtcManager {
|
|
|
5567
5507
|
this._micPaused = !enable;
|
|
5568
5508
|
this._pauseResumeMic();
|
|
5569
5509
|
}
|
|
5570
|
-
_handleStopOrResumeVideo({ enable, track }) {
|
|
5571
|
-
if (!enable) {
|
|
5572
|
-
if (this._webcamProducer && !this._webcamProducer.closed && this._webcamProducer.track === track) {
|
|
5573
|
-
this._stopProducer(this._webcamProducer);
|
|
5574
|
-
this._webcamProducer = null;
|
|
5575
|
-
this._webcamProducerOriginalSvcScalabilityMode = undefined;
|
|
5576
|
-
this._webcamProducerOriginalSvcMaxBitrate = undefined;
|
|
5577
|
-
this._webcamProducerHighestPreferredLayer = undefined;
|
|
5578
|
-
this._webcamTrack = null;
|
|
5579
|
-
}
|
|
5580
|
-
}
|
|
5581
|
-
else {
|
|
5582
|
-
this._sendWebcam(track);
|
|
5583
|
-
}
|
|
5584
|
-
}
|
|
5585
5510
|
stopOrResumeVideo({ enable }) {
|
|
5586
5511
|
logger$2.info("stopOrResumeVideo() [enable:%s]", enable);
|
|
5587
5512
|
this._webcamPaused = !enable;
|
|
@@ -5829,10 +5754,6 @@ class VegaRtcManager {
|
|
|
5829
5754
|
this._socketListenerDeregisterFunctions.forEach((func) => {
|
|
5830
5755
|
func();
|
|
5831
5756
|
});
|
|
5832
|
-
if (this._localStreamDeregisterFunction) {
|
|
5833
|
-
this._localStreamDeregisterFunction();
|
|
5834
|
-
this._localStreamDeregisterFunction = null;
|
|
5835
|
-
}
|
|
5836
5757
|
this._socketListenerDeregisterFunctions = [];
|
|
5837
5758
|
(_b = this._vegaConnection) === null || _b === void 0 ? void 0 : _b.removeAllListeners();
|
|
5838
5759
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.close();
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2490,7 +2490,6 @@ class P2pRtcManager {
|
|
|
2490
2490
|
this.peerConnections = {};
|
|
2491
2491
|
this._screenshareVideoTrackIds = [];
|
|
2492
2492
|
this._socketListenerDeregisterFunctions = [];
|
|
2493
|
-
this._localStreamDeregisterFunction = null;
|
|
2494
2493
|
this._emitter = emitter;
|
|
2495
2494
|
this._serverSocket = serverSocket;
|
|
2496
2495
|
this._webrtcProvider = webrtcProvider;
|
|
@@ -2576,21 +2575,6 @@ class P2pRtcManager {
|
|
|
2576
2575
|
this._monitorVideoTrack(beforeEffectTrack);
|
|
2577
2576
|
}
|
|
2578
2577
|
}
|
|
2579
|
-
this._enableStopResumeVideoForBrowserSDK(stream);
|
|
2580
|
-
}
|
|
2581
|
-
_enableStopResumeVideoForBrowserSDK(stream) {
|
|
2582
|
-
if (this._localStreamDeregisterFunction) {
|
|
2583
|
-
this._localStreamDeregisterFunction();
|
|
2584
|
-
this._localStreamDeregisterFunction = null;
|
|
2585
|
-
}
|
|
2586
|
-
const localStreamHandler = (e) => {
|
|
2587
|
-
const { enable, track } = e.detail;
|
|
2588
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
2589
|
-
};
|
|
2590
|
-
stream.addEventListener("stopresumevideo", localStreamHandler);
|
|
2591
|
-
this._localStreamDeregisterFunction = () => {
|
|
2592
|
-
stream.removeEventListener("stopresumevideo", localStreamHandler);
|
|
2593
|
-
};
|
|
2594
2578
|
}
|
|
2595
2579
|
addScreenshareStream(stream) {
|
|
2596
2580
|
logger$7.info("addScreenshareStream() [stream.id: %s]", stream.id);
|
|
@@ -2629,10 +2613,6 @@ class P2pRtcManager {
|
|
|
2629
2613
|
func();
|
|
2630
2614
|
});
|
|
2631
2615
|
this._socketListenerDeregisterFunctions = [];
|
|
2632
|
-
if (this._localStreamDeregisterFunction) {
|
|
2633
|
-
this._localStreamDeregisterFunction();
|
|
2634
|
-
this._localStreamDeregisterFunction = null;
|
|
2635
|
-
}
|
|
2636
2616
|
this.rtcStatsDisconnect();
|
|
2637
2617
|
}
|
|
2638
2618
|
setupSocketListeners() {
|
|
@@ -3081,9 +3061,6 @@ class P2pRtcManager {
|
|
|
3081
3061
|
if (this._features.increaseIncomingMediaBufferOn) {
|
|
3082
3062
|
this._setJitterBufferTarget(pc);
|
|
3083
3063
|
}
|
|
3084
|
-
if (this._localCameraStream && !this._localCameraStream.getVideoTracks().length && this._stoppedVideoTrack) {
|
|
3085
|
-
pc.addTrack(this._stoppedVideoTrack, this._localCameraStream);
|
|
3086
|
-
}
|
|
3087
3064
|
return session;
|
|
3088
3065
|
}
|
|
3089
3066
|
_cleanup(clientId) {
|
|
@@ -3106,11 +3083,6 @@ class P2pRtcManager {
|
|
|
3106
3083
|
this._withForcedRenegotiation(session, () => session.addStream(stream));
|
|
3107
3084
|
});
|
|
3108
3085
|
}
|
|
3109
|
-
_addTrackToPeerConnections(track) {
|
|
3110
|
-
this._forEachPeerConnection((session) => {
|
|
3111
|
-
this._withForcedRenegotiation(session, () => session.addTrack(track));
|
|
3112
|
-
});
|
|
3113
|
-
}
|
|
3114
3086
|
_replaceTrackToPeerConnections(oldTrack, newTrack) {
|
|
3115
3087
|
const promises = [];
|
|
3116
3088
|
this._forEachPeerConnection((session) => {
|
|
@@ -3396,20 +3368,6 @@ class P2pRtcManager {
|
|
|
3396
3368
|
}
|
|
3397
3369
|
stopOrResumeAudio() {
|
|
3398
3370
|
}
|
|
3399
|
-
_handleStopOrResumeVideo({ enable, track }) {
|
|
3400
|
-
if (!enable) {
|
|
3401
|
-
this._stoppedVideoTrack = track;
|
|
3402
|
-
}
|
|
3403
|
-
else {
|
|
3404
|
-
if (this._stoppedVideoTrack) {
|
|
3405
|
-
this._replaceTrackToPeerConnections(this._stoppedVideoTrack, track);
|
|
3406
|
-
delete this._stoppedVideoTrack;
|
|
3407
|
-
}
|
|
3408
|
-
else {
|
|
3409
|
-
this._addTrackToPeerConnections(track);
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
}
|
|
3413
3371
|
stopOrResumeVideo() {
|
|
3414
3372
|
}
|
|
3415
3373
|
removeScreenshareStream(stream, { requestedByClientId } = {}) {
|
|
@@ -4381,7 +4339,6 @@ class VegaRtcManager {
|
|
|
4381
4339
|
this._streamIdToVideoResolution = new Map();
|
|
4382
4340
|
this._consumers = new Map();
|
|
4383
4341
|
this._dataConsumers = new Map();
|
|
4384
|
-
this._localStreamDeregisterFunction = null;
|
|
4385
4342
|
this._micTrack = null;
|
|
4386
4343
|
this._webcamTrack = null;
|
|
4387
4344
|
this._screenVideoTrack = null;
|
|
@@ -5521,23 +5478,6 @@ class VegaRtcManager {
|
|
|
5521
5478
|
this._monitorAudioTrack(beforeEffectTrack);
|
|
5522
5479
|
}
|
|
5523
5480
|
}
|
|
5524
|
-
this._enableStopResumeVideoForBrowserSDK(stream);
|
|
5525
|
-
}
|
|
5526
|
-
_enableStopResumeVideoForBrowserSDK(stream) {
|
|
5527
|
-
if (this._localStreamDeregisterFunction) {
|
|
5528
|
-
this._localStreamDeregisterFunction();
|
|
5529
|
-
this._localStreamDeregisterFunction = null;
|
|
5530
|
-
}
|
|
5531
|
-
const localStreamHandler = (e) => {
|
|
5532
|
-
const { enable, track } = e.detail;
|
|
5533
|
-
this._webcamPaused = !enable;
|
|
5534
|
-
this._pauseResumeWebcam();
|
|
5535
|
-
this._handleStopOrResumeVideo({ enable, track });
|
|
5536
|
-
};
|
|
5537
|
-
stream.addEventListener("stopresumevideo", localStreamHandler);
|
|
5538
|
-
this._localStreamDeregisterFunction = () => {
|
|
5539
|
-
stream.removeEventListener("stopresumevideo", localStreamHandler);
|
|
5540
|
-
};
|
|
5541
5481
|
}
|
|
5542
5482
|
addScreenshareStream(stream) {
|
|
5543
5483
|
const videoTrack = stream.getVideoTracks()[0];
|
|
@@ -5567,21 +5507,6 @@ class VegaRtcManager {
|
|
|
5567
5507
|
this._micPaused = !enable;
|
|
5568
5508
|
this._pauseResumeMic();
|
|
5569
5509
|
}
|
|
5570
|
-
_handleStopOrResumeVideo({ enable, track }) {
|
|
5571
|
-
if (!enable) {
|
|
5572
|
-
if (this._webcamProducer && !this._webcamProducer.closed && this._webcamProducer.track === track) {
|
|
5573
|
-
this._stopProducer(this._webcamProducer);
|
|
5574
|
-
this._webcamProducer = null;
|
|
5575
|
-
this._webcamProducerOriginalSvcScalabilityMode = undefined;
|
|
5576
|
-
this._webcamProducerOriginalSvcMaxBitrate = undefined;
|
|
5577
|
-
this._webcamProducerHighestPreferredLayer = undefined;
|
|
5578
|
-
this._webcamTrack = null;
|
|
5579
|
-
}
|
|
5580
|
-
}
|
|
5581
|
-
else {
|
|
5582
|
-
this._sendWebcam(track);
|
|
5583
|
-
}
|
|
5584
|
-
}
|
|
5585
5510
|
stopOrResumeVideo({ enable }) {
|
|
5586
5511
|
logger$2.info("stopOrResumeVideo() [enable:%s]", enable);
|
|
5587
5512
|
this._webcamPaused = !enable;
|
|
@@ -5829,10 +5754,6 @@ class VegaRtcManager {
|
|
|
5829
5754
|
this._socketListenerDeregisterFunctions.forEach((func) => {
|
|
5830
5755
|
func();
|
|
5831
5756
|
});
|
|
5832
|
-
if (this._localStreamDeregisterFunction) {
|
|
5833
|
-
this._localStreamDeregisterFunction();
|
|
5834
|
-
this._localStreamDeregisterFunction = null;
|
|
5835
|
-
}
|
|
5836
5757
|
this._socketListenerDeregisterFunctions = [];
|
|
5837
5758
|
(_b = this._vegaConnection) === null || _b === void 0 ? void 0 : _b.removeAllListeners();
|
|
5838
5759
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.close();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/media",
|
|
3
3
|
"description": "Media library for Whereby",
|
|
4
|
-
"version": "11.4.
|
|
4
|
+
"version": "11.4.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/whereby/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"@types/sdp-transform": "^2.4.9",
|
|
59
59
|
"@types/uuid": "^9.0.1",
|
|
60
60
|
"@types/uuid-validate": "^0.0.3",
|
|
61
|
-
"eslint": "^9.29.0",
|
|
62
|
-
"jest-websocket-mock": "^2.5.0",
|
|
63
|
-
"prettier": "^3.5.3",
|
|
64
|
-
"process": "^0.11.10",
|
|
65
|
-
"typescript": "^5.8.3",
|
|
66
61
|
"@whereby.com/eslint-config": "0.1.0",
|
|
67
62
|
"@whereby.com/jest-config": "0.1.0",
|
|
68
63
|
"@whereby.com/prettier-config": "0.1.0",
|
|
69
64
|
"@whereby.com/rollup-config": "0.1.1",
|
|
70
|
-
"@whereby.com/tsconfig": "0.1.0"
|
|
65
|
+
"@whereby.com/tsconfig": "0.1.0",
|
|
66
|
+
"eslint": "^9.29.0",
|
|
67
|
+
"jest-websocket-mock": "^2.5.0",
|
|
68
|
+
"prettier": "^3.5.3",
|
|
69
|
+
"process": "^0.11.10",
|
|
70
|
+
"typescript": "^5.8.3"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=24.0.0"
|