@stream-io/video-client 0.3.1 → 0.3.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/CHANGELOG.md +19 -0
- package/dist/index.browser.es.js +137 -120
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +138 -119
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +137 -120
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +2 -1
- package/dist/src/devices/CameraManager.d.ts +3 -9
- package/dist/src/devices/InputMediaDeviceManager.d.ts +11 -5
- package/dist/src/devices/InputMediaDeviceManagerState.d.ts +6 -1
- package/dist/src/devices/MicrophoneManager.d.ts +3 -9
- package/dist/src/devices/MicrophoneManagerState.d.ts +1 -0
- package/dist/src/devices/index.d.ts +2 -0
- package/dist/src/rtc/Publisher.d.ts +2 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Call.ts +3 -2
- package/src/devices/CameraManager.ts +8 -17
- package/src/devices/CameraManagerState.ts +1 -1
- package/src/devices/InputMediaDeviceManager.ts +39 -17
- package/src/devices/InputMediaDeviceManagerState.ts +12 -2
- package/src/devices/MicrophoneManager.ts +8 -17
- package/src/devices/MicrophoneManagerState.ts +4 -0
- package/src/devices/__tests__/CameraManager.test.ts +4 -14
- package/src/devices/__tests__/InputMediaDeviceManager.test.ts +48 -5
- package/src/devices/__tests__/MicrophoneManager.test.ts +8 -7
- package/src/devices/index.ts +2 -0
- package/src/rtc/Publisher.ts +19 -21
- package/src/rtc/__tests__/Publisher.test.ts +67 -1
- package/src/rtc/videoLayers.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.3.3](https://github.com/GetStream/stream-video-js/compare/client0.3.2...client0.3.3) (2023-08-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Disable doesn't stop audio tracks ([#950](https://github.com/GetStream/stream-video-js/issues/950)) ([c348f34](https://github.com/GetStream/stream-video-js/commit/c348f34818f0e123e70b9471637ddd64411ebc08))
|
|
11
|
+
|
|
12
|
+
### [0.3.2](https://github.com/GetStream/stream-video-js/compare/client0.3.1...client0.3.2) (2023-08-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* use new device API in RN SDK and move to @stream-io/react-native-webrtc ([#925](https://github.com/GetStream/stream-video-js/issues/925)) ([8442d82](https://github.com/GetStream/stream-video-js/commit/8442d821a8eb97cb4be6e6d71b64337c04a86a15))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **client:** export missing classes ([#943](https://github.com/GetStream/stream-video-js/issues/943)) ([2964eb1](https://github.com/GetStream/stream-video-js/commit/2964eb16c405b7b7020ef9bfda81183f28e40b6b))
|
|
23
|
+
|
|
5
24
|
### [0.3.1](https://github.com/GetStream/stream-video-js/compare/client0.3.0...client0.3.1) (2023-08-16)
|
|
6
25
|
|
|
7
26
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -6,9 +6,9 @@ export { AxiosError } from 'axios';
|
|
|
6
6
|
import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport';
|
|
7
7
|
import { ReplaySubject, BehaviorSubject, distinctUntilChanged as distinctUntilChanged$1, Observable, debounceTime, concatMap, from, shareReplay, merge, map as map$2, combineLatest, filter, pairwise, takeWhile, tap, debounce, timer } from 'rxjs';
|
|
8
8
|
import * as SDP from 'sdp-transform';
|
|
9
|
+
import { UAParser } from 'ua-parser-js';
|
|
9
10
|
import WebSocket from 'isomorphic-ws';
|
|
10
11
|
import { take, map as map$1, distinctUntilChanged } from 'rxjs/operators';
|
|
11
|
-
import { UAParser } from 'ua-parser-js';
|
|
12
12
|
import { fromByteArray } from 'base64-js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -6266,6 +6266,56 @@ function getIceCandidate(candidate) {
|
|
|
6266
6266
|
}
|
|
6267
6267
|
}
|
|
6268
6268
|
|
|
6269
|
+
let sdkInfo;
|
|
6270
|
+
let osInfo;
|
|
6271
|
+
let deviceInfo;
|
|
6272
|
+
const setSdkInfo = (info) => {
|
|
6273
|
+
sdkInfo = info;
|
|
6274
|
+
};
|
|
6275
|
+
const getSdkInfo = () => {
|
|
6276
|
+
return sdkInfo;
|
|
6277
|
+
};
|
|
6278
|
+
const setOSInfo = (info) => {
|
|
6279
|
+
osInfo = info;
|
|
6280
|
+
};
|
|
6281
|
+
const getOSInfo = () => {
|
|
6282
|
+
return osInfo;
|
|
6283
|
+
};
|
|
6284
|
+
const setDeviceInfo = (info) => {
|
|
6285
|
+
deviceInfo = info;
|
|
6286
|
+
};
|
|
6287
|
+
const getDeviceInfo = () => {
|
|
6288
|
+
return deviceInfo;
|
|
6289
|
+
};
|
|
6290
|
+
const getClientDetails = () => {
|
|
6291
|
+
if (isReactNative()) {
|
|
6292
|
+
// Since RN doesn't support web, sharing browser info is not required
|
|
6293
|
+
return {
|
|
6294
|
+
sdk: getSdkInfo(),
|
|
6295
|
+
os: getOSInfo(),
|
|
6296
|
+
device: getDeviceInfo(),
|
|
6297
|
+
};
|
|
6298
|
+
}
|
|
6299
|
+
const userAgent = new UAParser(navigator.userAgent);
|
|
6300
|
+
const { browser, os, device, cpu } = userAgent.getResult();
|
|
6301
|
+
return {
|
|
6302
|
+
sdk: getSdkInfo(),
|
|
6303
|
+
browser: {
|
|
6304
|
+
name: browser.name || navigator.userAgent,
|
|
6305
|
+
version: browser.version || '',
|
|
6306
|
+
},
|
|
6307
|
+
os: {
|
|
6308
|
+
name: os.name || '',
|
|
6309
|
+
version: os.version || '',
|
|
6310
|
+
architecture: cpu.architecture || '',
|
|
6311
|
+
},
|
|
6312
|
+
device: {
|
|
6313
|
+
name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
|
|
6314
|
+
version: '',
|
|
6315
|
+
},
|
|
6316
|
+
};
|
|
6317
|
+
};
|
|
6318
|
+
|
|
6269
6319
|
const DEFAULT_BITRATE = 1250000;
|
|
6270
6320
|
const defaultTargetResolution = {
|
|
6271
6321
|
bitrate: DEFAULT_BITRATE,
|
|
@@ -6280,9 +6330,11 @@ const defaultTargetResolution = {
|
|
|
6280
6330
|
* @param targetResolution the expected target resolution.
|
|
6281
6331
|
*/
|
|
6282
6332
|
const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetResolution) => {
|
|
6333
|
+
var _a;
|
|
6283
6334
|
const optimalVideoLayers = [];
|
|
6284
6335
|
const settings = videoTrack.getSettings();
|
|
6285
6336
|
const { width: w = 0, height: h = 0 } = settings;
|
|
6337
|
+
const isRNIos = isReactNative() && ((_a = getOSInfo()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) === 'ios';
|
|
6286
6338
|
const maxBitrate = getComputedMaxBitrate(targetResolution, w, h);
|
|
6287
6339
|
let downscaleFactor = 1;
|
|
6288
6340
|
['f', 'h', 'q'].forEach((rid) => {
|
|
@@ -6296,10 +6348,11 @@ const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetReso
|
|
|
6296
6348
|
height: Math.round(h / downscaleFactor),
|
|
6297
6349
|
maxBitrate: Math.round(maxBitrate / downscaleFactor),
|
|
6298
6350
|
scaleResolutionDownBy: downscaleFactor,
|
|
6351
|
+
// Simulcast on iOS React-Native requires all encodings to share the same framerate
|
|
6299
6352
|
maxFramerate: {
|
|
6300
6353
|
f: 30,
|
|
6301
|
-
h: 25,
|
|
6302
|
-
q: 20,
|
|
6354
|
+
h: isRNIos ? 30 : 25,
|
|
6355
|
+
q: isRNIos ? 30 : 20,
|
|
6303
6356
|
}[rid],
|
|
6304
6357
|
});
|
|
6305
6358
|
downscaleFactor *= 2;
|
|
@@ -6498,6 +6551,7 @@ class Publisher {
|
|
|
6498
6551
|
* @param opts
|
|
6499
6552
|
*/
|
|
6500
6553
|
this.publishStream = (mediaStream, track, trackType, opts = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
6554
|
+
var _a;
|
|
6501
6555
|
if (track.readyState === 'ended') {
|
|
6502
6556
|
throw new Error(`Can't publish a track that has ended already.`);
|
|
6503
6557
|
}
|
|
@@ -6525,7 +6579,14 @@ class Publisher {
|
|
|
6525
6579
|
const videoEncodings = trackType === TrackType.VIDEO
|
|
6526
6580
|
? findOptimalVideoLayers(track, targetResolution)
|
|
6527
6581
|
: undefined;
|
|
6528
|
-
|
|
6582
|
+
let preferredCodec = opts.preferredCodec;
|
|
6583
|
+
if (!preferredCodec && trackType === TrackType.VIDEO) {
|
|
6584
|
+
const isRNAndroid = isReactNative() && ((_a = getOSInfo()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) === 'android';
|
|
6585
|
+
if (isRNAndroid) {
|
|
6586
|
+
preferredCodec = 'VP8';
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
const codecPreferences = this.getCodecPreferences(trackType, preferredCodec);
|
|
6529
6590
|
// listen for 'ended' event on the track as it might be ended abruptly
|
|
6530
6591
|
// by an external factor as permission revokes, device disconnected, etc.
|
|
6531
6592
|
// keep in mind that `track.stop()` doesn't trigger this event.
|
|
@@ -6553,6 +6614,9 @@ class Publisher {
|
|
|
6553
6614
|
previousTrack.removeEventListener('ended', handleTrackEnded);
|
|
6554
6615
|
track.addEventListener('ended', handleTrackEnded);
|
|
6555
6616
|
}
|
|
6617
|
+
if (!track.enabled) {
|
|
6618
|
+
track.enabled = true;
|
|
6619
|
+
}
|
|
6556
6620
|
yield transceiver.sender.replaceTrack(track);
|
|
6557
6621
|
}
|
|
6558
6622
|
yield this.notifyTrackMuteStateChanged(mediaStream, track, trackType, false);
|
|
@@ -6561,15 +6625,18 @@ class Publisher {
|
|
|
6561
6625
|
* Stops publishing the given track type to the SFU, if it is currently being published.
|
|
6562
6626
|
* Underlying track will be stopped and removed from the publisher.
|
|
6563
6627
|
* @param trackType the track type to unpublish.
|
|
6628
|
+
* @param stopTrack specifies whether track should be stopped or just disabled
|
|
6564
6629
|
*/
|
|
6565
|
-
this.unpublishStream = (trackType) => __awaiter(this, void 0, void 0, function* () {
|
|
6630
|
+
this.unpublishStream = (trackType, stopTrack) => __awaiter(this, void 0, void 0, function* () {
|
|
6566
6631
|
const transceiver = this.pc
|
|
6567
6632
|
.getTransceivers()
|
|
6568
6633
|
.find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
|
|
6569
6634
|
if (transceiver &&
|
|
6570
6635
|
transceiver.sender.track &&
|
|
6571
6636
|
transceiver.sender.track.readyState === 'live') {
|
|
6572
|
-
|
|
6637
|
+
stopTrack
|
|
6638
|
+
? transceiver.sender.track.stop()
|
|
6639
|
+
: (transceiver.sender.track.enabled = false);
|
|
6573
6640
|
return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6574
6641
|
}
|
|
6575
6642
|
});
|
|
@@ -6619,9 +6686,9 @@ class Publisher {
|
|
|
6619
6686
|
});
|
|
6620
6687
|
};
|
|
6621
6688
|
this.updateVideoPublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
|
|
6622
|
-
var
|
|
6689
|
+
var _b;
|
|
6623
6690
|
logger$3('info', 'Update publish quality, requested rids by SFU:', enabledRids);
|
|
6624
|
-
const videoSender = (
|
|
6691
|
+
const videoSender = (_b = this.transceiverRegistry[TrackType.VIDEO]) === null || _b === void 0 ? void 0 : _b.sender;
|
|
6625
6692
|
if (!videoSender) {
|
|
6626
6693
|
logger$3('warn', 'Update publish quality, no video sender found.');
|
|
6627
6694
|
return;
|
|
@@ -6719,8 +6786,8 @@ class Publisher {
|
|
|
6719
6786
|
* @param options the optional offer options to use.
|
|
6720
6787
|
*/
|
|
6721
6788
|
this.negotiate = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
6722
|
-
var
|
|
6723
|
-
this.isIceRestarting = (
|
|
6789
|
+
var _c;
|
|
6790
|
+
this.isIceRestarting = (_c = options === null || options === void 0 ? void 0 : options.iceRestart) !== null && _c !== void 0 ? _c : false;
|
|
6724
6791
|
const offer = yield this.pc.createOffer(options);
|
|
6725
6792
|
offer.sdp = this.mungeCodecs(offer.sdp);
|
|
6726
6793
|
const trackInfos = this.getCurrentTrackInfos(offer.sdp);
|
|
@@ -6758,15 +6825,6 @@ class Publisher {
|
|
|
6758
6825
|
this.mungeCodecs = (sdp) => {
|
|
6759
6826
|
if (sdp) {
|
|
6760
6827
|
sdp = toggleDtx(sdp, this.isDtxEnabled);
|
|
6761
|
-
if (isReactNative()) {
|
|
6762
|
-
if (this.preferredVideoCodec) {
|
|
6763
|
-
sdp = setPreferredCodec(sdp, 'video', this.preferredVideoCodec);
|
|
6764
|
-
}
|
|
6765
|
-
sdp = setPreferredCodec(sdp, 'audio', this.isRedEnabled ? 'red' : 'opus');
|
|
6766
|
-
if (!this.isRedEnabled) {
|
|
6767
|
-
sdp = removeCodec(sdp, 'audio', 'red');
|
|
6768
|
-
}
|
|
6769
|
-
}
|
|
6770
6828
|
}
|
|
6771
6829
|
return sdp;
|
|
6772
6830
|
};
|
|
@@ -9464,58 +9522,9 @@ const CallTypes = new CallTypesRegistry([
|
|
|
9464
9522
|
}),
|
|
9465
9523
|
]);
|
|
9466
9524
|
|
|
9467
|
-
let sdkInfo;
|
|
9468
|
-
let osInfo;
|
|
9469
|
-
let deviceInfo;
|
|
9470
|
-
const setSdkInfo = (info) => {
|
|
9471
|
-
sdkInfo = info;
|
|
9472
|
-
};
|
|
9473
|
-
const getSdkInfo = () => {
|
|
9474
|
-
return sdkInfo;
|
|
9475
|
-
};
|
|
9476
|
-
const setOSInfo = (info) => {
|
|
9477
|
-
osInfo = info;
|
|
9478
|
-
};
|
|
9479
|
-
const getOSInfo = () => {
|
|
9480
|
-
return osInfo;
|
|
9481
|
-
};
|
|
9482
|
-
const setDeviceInfo = (info) => {
|
|
9483
|
-
deviceInfo = info;
|
|
9484
|
-
};
|
|
9485
|
-
const getDeviceInfo = () => {
|
|
9486
|
-
return deviceInfo;
|
|
9487
|
-
};
|
|
9488
|
-
const getClientDetails = () => {
|
|
9489
|
-
if (isReactNative()) {
|
|
9490
|
-
// Since RN doesn't support web, sharing browser info is not required
|
|
9491
|
-
return {
|
|
9492
|
-
sdk: getSdkInfo(),
|
|
9493
|
-
os: getOSInfo(),
|
|
9494
|
-
device: getDeviceInfo(),
|
|
9495
|
-
};
|
|
9496
|
-
}
|
|
9497
|
-
const userAgent = new UAParser(navigator.userAgent);
|
|
9498
|
-
const { browser, os, device, cpu } = userAgent.getResult();
|
|
9499
|
-
return {
|
|
9500
|
-
sdk: getSdkInfo(),
|
|
9501
|
-
browser: {
|
|
9502
|
-
name: browser.name || navigator.userAgent,
|
|
9503
|
-
version: browser.version || '',
|
|
9504
|
-
},
|
|
9505
|
-
os: {
|
|
9506
|
-
name: os.name || '',
|
|
9507
|
-
version: os.version || '',
|
|
9508
|
-
architecture: cpu.architecture || '',
|
|
9509
|
-
},
|
|
9510
|
-
device: {
|
|
9511
|
-
name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
|
|
9512
|
-
version: '',
|
|
9513
|
-
},
|
|
9514
|
-
};
|
|
9515
|
-
};
|
|
9516
|
-
|
|
9517
9525
|
class InputMediaDeviceManagerState {
|
|
9518
|
-
constructor() {
|
|
9526
|
+
constructor(disableMode = 'stop-tracks') {
|
|
9527
|
+
this.disableMode = disableMode;
|
|
9519
9528
|
this.statusSubject = new BehaviorSubject(undefined);
|
|
9520
9529
|
this.mediaStreamSubject = new BehaviorSubject(undefined);
|
|
9521
9530
|
this.selectedDeviceSubject = new BehaviorSubject(undefined);
|
|
@@ -9542,7 +9551,9 @@ class InputMediaDeviceManagerState {
|
|
|
9542
9551
|
this.selectedDevice$ = this.selectedDeviceSubject
|
|
9543
9552
|
.asObservable()
|
|
9544
9553
|
.pipe(distinctUntilChanged$1());
|
|
9545
|
-
this.status$ = this.statusSubject
|
|
9554
|
+
this.status$ = this.statusSubject
|
|
9555
|
+
.asObservable()
|
|
9556
|
+
.pipe(distinctUntilChanged$1());
|
|
9546
9557
|
}
|
|
9547
9558
|
/**
|
|
9548
9559
|
* The device status
|
|
@@ -9590,7 +9601,7 @@ class InputMediaDeviceManagerState {
|
|
|
9590
9601
|
|
|
9591
9602
|
class CameraManagerState extends InputMediaDeviceManagerState {
|
|
9592
9603
|
constructor() {
|
|
9593
|
-
super();
|
|
9604
|
+
super('stop-tracks');
|
|
9594
9605
|
this.directionSubject = new BehaviorSubject(undefined);
|
|
9595
9606
|
this.direction$ = this.directionSubject
|
|
9596
9607
|
.asObservable()
|
|
@@ -9903,12 +9914,13 @@ class InputMediaDeviceManager {
|
|
|
9903
9914
|
if (this.state.status === 'enabled') {
|
|
9904
9915
|
return;
|
|
9905
9916
|
}
|
|
9906
|
-
yield this.
|
|
9917
|
+
yield this.unmuteStream();
|
|
9907
9918
|
this.state.setStatus('enabled');
|
|
9908
9919
|
});
|
|
9909
9920
|
}
|
|
9910
9921
|
/**
|
|
9911
9922
|
* Stops camera/microphone
|
|
9923
|
+
*
|
|
9912
9924
|
* @returns
|
|
9913
9925
|
*/
|
|
9914
9926
|
disable() {
|
|
@@ -9916,12 +9928,25 @@ class InputMediaDeviceManager {
|
|
|
9916
9928
|
if (this.state.status === 'disabled') {
|
|
9917
9929
|
return;
|
|
9918
9930
|
}
|
|
9919
|
-
|
|
9931
|
+
this.state.prevStatus = this.state.status;
|
|
9932
|
+
yield this.muteStream(this.state.disableMode === 'stop-tracks');
|
|
9920
9933
|
this.state.setStatus('disabled');
|
|
9921
9934
|
});
|
|
9922
9935
|
}
|
|
9936
|
+
/**
|
|
9937
|
+
* If status was previously enabled, it will reenable the device.
|
|
9938
|
+
*/
|
|
9939
|
+
resume() {
|
|
9940
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9941
|
+
if (this.state.prevStatus === 'enabled' &&
|
|
9942
|
+
this.state.status === 'disabled') {
|
|
9943
|
+
this.enable();
|
|
9944
|
+
}
|
|
9945
|
+
});
|
|
9946
|
+
}
|
|
9923
9947
|
/**
|
|
9924
9948
|
* If current device statis is disabled, it will enable the device, else it will disable it.
|
|
9949
|
+
*
|
|
9925
9950
|
* @returns
|
|
9926
9951
|
*/
|
|
9927
9952
|
toggle() {
|
|
@@ -9956,32 +9981,40 @@ class InputMediaDeviceManager {
|
|
|
9956
9981
|
applySettingsToStream() {
|
|
9957
9982
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9958
9983
|
if (this.state.status === 'enabled') {
|
|
9959
|
-
yield this.
|
|
9960
|
-
yield this.
|
|
9984
|
+
yield this.muteStream();
|
|
9985
|
+
yield this.unmuteStream();
|
|
9961
9986
|
}
|
|
9962
9987
|
});
|
|
9963
9988
|
}
|
|
9964
|
-
|
|
9989
|
+
muteStream(stopTracks = true) {
|
|
9965
9990
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9966
9991
|
if (!this.state.mediaStream) {
|
|
9967
9992
|
return;
|
|
9968
9993
|
}
|
|
9969
9994
|
if (this.call.state.callingState === CallingState.JOINED) {
|
|
9970
|
-
yield this.stopPublishStream();
|
|
9995
|
+
yield this.stopPublishStream(stopTracks);
|
|
9971
9996
|
}
|
|
9972
9997
|
else if (this.state.mediaStream) {
|
|
9973
|
-
|
|
9998
|
+
stopTracks
|
|
9999
|
+
? disposeOfMediaStream(this.state.mediaStream)
|
|
10000
|
+
: this.muteTracks();
|
|
10001
|
+
}
|
|
10002
|
+
if (stopTracks) {
|
|
10003
|
+
this.state.setMediaStream(undefined);
|
|
9974
10004
|
}
|
|
9975
|
-
this.state.setMediaStream(undefined);
|
|
9976
10005
|
});
|
|
9977
10006
|
}
|
|
9978
|
-
|
|
10007
|
+
unmuteStream() {
|
|
9979
10008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10009
|
+
let stream;
|
|
9980
10010
|
if (this.state.mediaStream) {
|
|
9981
|
-
|
|
10011
|
+
stream = this.state.mediaStream;
|
|
10012
|
+
this.unmuteTracks();
|
|
10013
|
+
}
|
|
10014
|
+
else {
|
|
10015
|
+
const constraints = { deviceId: this.state.selectedDevice };
|
|
10016
|
+
stream = yield this.getStream(constraints);
|
|
9982
10017
|
}
|
|
9983
|
-
const constraints = { deviceId: this.state.selectedDevice };
|
|
9984
|
-
const stream = yield this.getStream(constraints);
|
|
9985
10018
|
if (this.call.state.callingState === CallingState.JOINED) {
|
|
9986
10019
|
yield this.publishStream(stream);
|
|
9987
10020
|
}
|
|
@@ -10033,30 +10066,23 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10033
10066
|
publishStream(stream) {
|
|
10034
10067
|
return this.call.publishVideoStream(stream);
|
|
10035
10068
|
}
|
|
10036
|
-
stopPublishStream() {
|
|
10037
|
-
return this.call.stopPublish(TrackType.VIDEO);
|
|
10069
|
+
stopPublishStream(stopTracks) {
|
|
10070
|
+
return this.call.stopPublish(TrackType.VIDEO, stopTracks);
|
|
10038
10071
|
}
|
|
10039
|
-
|
|
10040
|
-
* Disables the video tracks of the camera
|
|
10041
|
-
*/
|
|
10042
|
-
pause() {
|
|
10072
|
+
muteTracks() {
|
|
10043
10073
|
var _a;
|
|
10044
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((
|
|
10045
|
-
track.enabled = false;
|
|
10046
|
-
});
|
|
10074
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((t) => (t.enabled = false));
|
|
10047
10075
|
}
|
|
10048
|
-
|
|
10049
|
-
* (Re)enables the video tracks of the camera
|
|
10050
|
-
*/
|
|
10051
|
-
resume() {
|
|
10076
|
+
unmuteTracks() {
|
|
10052
10077
|
var _a;
|
|
10053
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((
|
|
10054
|
-
track.enabled = true;
|
|
10055
|
-
});
|
|
10078
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((t) => (t.enabled = true));
|
|
10056
10079
|
}
|
|
10057
10080
|
}
|
|
10058
10081
|
|
|
10059
10082
|
class MicrophoneManagerState extends InputMediaDeviceManagerState {
|
|
10083
|
+
constructor() {
|
|
10084
|
+
super('disable-tracks');
|
|
10085
|
+
}
|
|
10060
10086
|
getDeviceIdFromStream(stream) {
|
|
10061
10087
|
var _a;
|
|
10062
10088
|
return (_a = stream.getAudioTracks()[0]) === null || _a === void 0 ? void 0 : _a.getSettings().deviceId;
|
|
@@ -10076,26 +10102,16 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
10076
10102
|
publishStream(stream) {
|
|
10077
10103
|
return this.call.publishAudioStream(stream);
|
|
10078
10104
|
}
|
|
10079
|
-
stopPublishStream() {
|
|
10080
|
-
return this.call.stopPublish(TrackType.AUDIO);
|
|
10105
|
+
stopPublishStream(stopTracks) {
|
|
10106
|
+
return this.call.stopPublish(TrackType.AUDIO, stopTracks);
|
|
10081
10107
|
}
|
|
10082
|
-
|
|
10083
|
-
* Disables the audio tracks of the microphone
|
|
10084
|
-
*/
|
|
10085
|
-
pause() {
|
|
10108
|
+
muteTracks() {
|
|
10086
10109
|
var _a;
|
|
10087
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((
|
|
10088
|
-
track.enabled = false;
|
|
10089
|
-
});
|
|
10110
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((t) => (t.enabled = false));
|
|
10090
10111
|
}
|
|
10091
|
-
|
|
10092
|
-
* (Re)enables the audio tracks of the microphone
|
|
10093
|
-
*/
|
|
10094
|
-
resume() {
|
|
10112
|
+
unmuteTracks() {
|
|
10095
10113
|
var _a;
|
|
10096
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((
|
|
10097
|
-
track.enabled = true;
|
|
10098
|
-
});
|
|
10114
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((t) => (t.enabled = true));
|
|
10099
10115
|
}
|
|
10100
10116
|
}
|
|
10101
10117
|
|
|
@@ -10659,11 +10675,12 @@ class Call {
|
|
|
10659
10675
|
*
|
|
10660
10676
|
*
|
|
10661
10677
|
* @param trackType the track type to stop publishing.
|
|
10678
|
+
* @param stopTrack if `true` the track will be stopped, else it will be just disabled
|
|
10662
10679
|
*/
|
|
10663
|
-
this.stopPublish = (trackType) => __awaiter(this, void 0, void 0, function* () {
|
|
10680
|
+
this.stopPublish = (trackType, stopTrack = true) => __awaiter(this, void 0, void 0, function* () {
|
|
10664
10681
|
var _j;
|
|
10665
10682
|
this.logger('info', `stopPublish ${TrackType[trackType]}`);
|
|
10666
|
-
yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType));
|
|
10683
|
+
yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType, stopTrack));
|
|
10667
10684
|
});
|
|
10668
10685
|
/**
|
|
10669
10686
|
* Update track subscription configuration for one or more participants.
|
|
@@ -12435,7 +12452,7 @@ class WSConnectionFallback {
|
|
|
12435
12452
|
}
|
|
12436
12453
|
}
|
|
12437
12454
|
|
|
12438
|
-
const version = '0.3.
|
|
12455
|
+
const version = '0.3.3';
|
|
12439
12456
|
|
|
12440
12457
|
const logger = getLogger(['location']);
|
|
12441
12458
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -13489,5 +13506,5 @@ var browsers = /*#__PURE__*/Object.freeze({
|
|
|
13489
13506
|
isSafari: isSafari
|
|
13490
13507
|
});
|
|
13491
13508
|
|
|
13492
|
-
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
|
|
13509
|
+
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
|
|
13493
13510
|
//# sourceMappingURL=index.browser.es.js.map
|