@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/dist/index.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 https from 'https';
|
|
13
13
|
import jwt from 'jsonwebtoken';
|
|
14
14
|
import 'crypto';
|
|
@@ -6269,6 +6269,56 @@ function getIceCandidate(candidate) {
|
|
|
6269
6269
|
}
|
|
6270
6270
|
}
|
|
6271
6271
|
|
|
6272
|
+
let sdkInfo;
|
|
6273
|
+
let osInfo;
|
|
6274
|
+
let deviceInfo;
|
|
6275
|
+
const setSdkInfo = (info) => {
|
|
6276
|
+
sdkInfo = info;
|
|
6277
|
+
};
|
|
6278
|
+
const getSdkInfo = () => {
|
|
6279
|
+
return sdkInfo;
|
|
6280
|
+
};
|
|
6281
|
+
const setOSInfo = (info) => {
|
|
6282
|
+
osInfo = info;
|
|
6283
|
+
};
|
|
6284
|
+
const getOSInfo = () => {
|
|
6285
|
+
return osInfo;
|
|
6286
|
+
};
|
|
6287
|
+
const setDeviceInfo = (info) => {
|
|
6288
|
+
deviceInfo = info;
|
|
6289
|
+
};
|
|
6290
|
+
const getDeviceInfo = () => {
|
|
6291
|
+
return deviceInfo;
|
|
6292
|
+
};
|
|
6293
|
+
const getClientDetails = () => {
|
|
6294
|
+
if (isReactNative()) {
|
|
6295
|
+
// Since RN doesn't support web, sharing browser info is not required
|
|
6296
|
+
return {
|
|
6297
|
+
sdk: getSdkInfo(),
|
|
6298
|
+
os: getOSInfo(),
|
|
6299
|
+
device: getDeviceInfo(),
|
|
6300
|
+
};
|
|
6301
|
+
}
|
|
6302
|
+
const userAgent = new UAParser(navigator.userAgent);
|
|
6303
|
+
const { browser, os, device, cpu } = userAgent.getResult();
|
|
6304
|
+
return {
|
|
6305
|
+
sdk: getSdkInfo(),
|
|
6306
|
+
browser: {
|
|
6307
|
+
name: browser.name || navigator.userAgent,
|
|
6308
|
+
version: browser.version || '',
|
|
6309
|
+
},
|
|
6310
|
+
os: {
|
|
6311
|
+
name: os.name || '',
|
|
6312
|
+
version: os.version || '',
|
|
6313
|
+
architecture: cpu.architecture || '',
|
|
6314
|
+
},
|
|
6315
|
+
device: {
|
|
6316
|
+
name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
|
|
6317
|
+
version: '',
|
|
6318
|
+
},
|
|
6319
|
+
};
|
|
6320
|
+
};
|
|
6321
|
+
|
|
6272
6322
|
const DEFAULT_BITRATE = 1250000;
|
|
6273
6323
|
const defaultTargetResolution = {
|
|
6274
6324
|
bitrate: DEFAULT_BITRATE,
|
|
@@ -6283,9 +6333,11 @@ const defaultTargetResolution = {
|
|
|
6283
6333
|
* @param targetResolution the expected target resolution.
|
|
6284
6334
|
*/
|
|
6285
6335
|
const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetResolution) => {
|
|
6336
|
+
var _a;
|
|
6286
6337
|
const optimalVideoLayers = [];
|
|
6287
6338
|
const settings = videoTrack.getSettings();
|
|
6288
6339
|
const { width: w = 0, height: h = 0 } = settings;
|
|
6340
|
+
const isRNIos = isReactNative() && ((_a = getOSInfo()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) === 'ios';
|
|
6289
6341
|
const maxBitrate = getComputedMaxBitrate(targetResolution, w, h);
|
|
6290
6342
|
let downscaleFactor = 1;
|
|
6291
6343
|
['f', 'h', 'q'].forEach((rid) => {
|
|
@@ -6299,10 +6351,11 @@ const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetReso
|
|
|
6299
6351
|
height: Math.round(h / downscaleFactor),
|
|
6300
6352
|
maxBitrate: Math.round(maxBitrate / downscaleFactor),
|
|
6301
6353
|
scaleResolutionDownBy: downscaleFactor,
|
|
6354
|
+
// Simulcast on iOS React-Native requires all encodings to share the same framerate
|
|
6302
6355
|
maxFramerate: {
|
|
6303
6356
|
f: 30,
|
|
6304
|
-
h: 25,
|
|
6305
|
-
q: 20,
|
|
6357
|
+
h: isRNIos ? 30 : 25,
|
|
6358
|
+
q: isRNIos ? 30 : 20,
|
|
6306
6359
|
}[rid],
|
|
6307
6360
|
});
|
|
6308
6361
|
downscaleFactor *= 2;
|
|
@@ -6501,6 +6554,7 @@ class Publisher {
|
|
|
6501
6554
|
* @param opts
|
|
6502
6555
|
*/
|
|
6503
6556
|
this.publishStream = (mediaStream, track, trackType, opts = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
6557
|
+
var _a;
|
|
6504
6558
|
if (track.readyState === 'ended') {
|
|
6505
6559
|
throw new Error(`Can't publish a track that has ended already.`);
|
|
6506
6560
|
}
|
|
@@ -6528,7 +6582,14 @@ class Publisher {
|
|
|
6528
6582
|
const videoEncodings = trackType === TrackType.VIDEO
|
|
6529
6583
|
? findOptimalVideoLayers(track, targetResolution)
|
|
6530
6584
|
: undefined;
|
|
6531
|
-
|
|
6585
|
+
let preferredCodec = opts.preferredCodec;
|
|
6586
|
+
if (!preferredCodec && trackType === TrackType.VIDEO) {
|
|
6587
|
+
const isRNAndroid = isReactNative() && ((_a = getOSInfo()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) === 'android';
|
|
6588
|
+
if (isRNAndroid) {
|
|
6589
|
+
preferredCodec = 'VP8';
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
const codecPreferences = this.getCodecPreferences(trackType, preferredCodec);
|
|
6532
6593
|
// listen for 'ended' event on the track as it might be ended abruptly
|
|
6533
6594
|
// by an external factor as permission revokes, device disconnected, etc.
|
|
6534
6595
|
// keep in mind that `track.stop()` doesn't trigger this event.
|
|
@@ -6556,6 +6617,9 @@ class Publisher {
|
|
|
6556
6617
|
previousTrack.removeEventListener('ended', handleTrackEnded);
|
|
6557
6618
|
track.addEventListener('ended', handleTrackEnded);
|
|
6558
6619
|
}
|
|
6620
|
+
if (!track.enabled) {
|
|
6621
|
+
track.enabled = true;
|
|
6622
|
+
}
|
|
6559
6623
|
yield transceiver.sender.replaceTrack(track);
|
|
6560
6624
|
}
|
|
6561
6625
|
yield this.notifyTrackMuteStateChanged(mediaStream, track, trackType, false);
|
|
@@ -6564,15 +6628,18 @@ class Publisher {
|
|
|
6564
6628
|
* Stops publishing the given track type to the SFU, if it is currently being published.
|
|
6565
6629
|
* Underlying track will be stopped and removed from the publisher.
|
|
6566
6630
|
* @param trackType the track type to unpublish.
|
|
6631
|
+
* @param stopTrack specifies whether track should be stopped or just disabled
|
|
6567
6632
|
*/
|
|
6568
|
-
this.unpublishStream = (trackType) => __awaiter(this, void 0, void 0, function* () {
|
|
6633
|
+
this.unpublishStream = (trackType, stopTrack) => __awaiter(this, void 0, void 0, function* () {
|
|
6569
6634
|
const transceiver = this.pc
|
|
6570
6635
|
.getTransceivers()
|
|
6571
6636
|
.find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
|
|
6572
6637
|
if (transceiver &&
|
|
6573
6638
|
transceiver.sender.track &&
|
|
6574
6639
|
transceiver.sender.track.readyState === 'live') {
|
|
6575
|
-
|
|
6640
|
+
stopTrack
|
|
6641
|
+
? transceiver.sender.track.stop()
|
|
6642
|
+
: (transceiver.sender.track.enabled = false);
|
|
6576
6643
|
return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6577
6644
|
}
|
|
6578
6645
|
});
|
|
@@ -6622,9 +6689,9 @@ class Publisher {
|
|
|
6622
6689
|
});
|
|
6623
6690
|
};
|
|
6624
6691
|
this.updateVideoPublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
|
|
6625
|
-
var
|
|
6692
|
+
var _b;
|
|
6626
6693
|
logger$3('info', 'Update publish quality, requested rids by SFU:', enabledRids);
|
|
6627
|
-
const videoSender = (
|
|
6694
|
+
const videoSender = (_b = this.transceiverRegistry[TrackType.VIDEO]) === null || _b === void 0 ? void 0 : _b.sender;
|
|
6628
6695
|
if (!videoSender) {
|
|
6629
6696
|
logger$3('warn', 'Update publish quality, no video sender found.');
|
|
6630
6697
|
return;
|
|
@@ -6722,8 +6789,8 @@ class Publisher {
|
|
|
6722
6789
|
* @param options the optional offer options to use.
|
|
6723
6790
|
*/
|
|
6724
6791
|
this.negotiate = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
6725
|
-
var
|
|
6726
|
-
this.isIceRestarting = (
|
|
6792
|
+
var _c;
|
|
6793
|
+
this.isIceRestarting = (_c = options === null || options === void 0 ? void 0 : options.iceRestart) !== null && _c !== void 0 ? _c : false;
|
|
6727
6794
|
const offer = yield this.pc.createOffer(options);
|
|
6728
6795
|
offer.sdp = this.mungeCodecs(offer.sdp);
|
|
6729
6796
|
const trackInfos = this.getCurrentTrackInfos(offer.sdp);
|
|
@@ -6761,15 +6828,6 @@ class Publisher {
|
|
|
6761
6828
|
this.mungeCodecs = (sdp) => {
|
|
6762
6829
|
if (sdp) {
|
|
6763
6830
|
sdp = toggleDtx(sdp, this.isDtxEnabled);
|
|
6764
|
-
if (isReactNative()) {
|
|
6765
|
-
if (this.preferredVideoCodec) {
|
|
6766
|
-
sdp = setPreferredCodec(sdp, 'video', this.preferredVideoCodec);
|
|
6767
|
-
}
|
|
6768
|
-
sdp = setPreferredCodec(sdp, 'audio', this.isRedEnabled ? 'red' : 'opus');
|
|
6769
|
-
if (!this.isRedEnabled) {
|
|
6770
|
-
sdp = removeCodec(sdp, 'audio', 'red');
|
|
6771
|
-
}
|
|
6772
|
-
}
|
|
6773
6831
|
}
|
|
6774
6832
|
return sdp;
|
|
6775
6833
|
};
|
|
@@ -9467,58 +9525,9 @@ const CallTypes = new CallTypesRegistry([
|
|
|
9467
9525
|
}),
|
|
9468
9526
|
]);
|
|
9469
9527
|
|
|
9470
|
-
let sdkInfo;
|
|
9471
|
-
let osInfo;
|
|
9472
|
-
let deviceInfo;
|
|
9473
|
-
const setSdkInfo = (info) => {
|
|
9474
|
-
sdkInfo = info;
|
|
9475
|
-
};
|
|
9476
|
-
const getSdkInfo = () => {
|
|
9477
|
-
return sdkInfo;
|
|
9478
|
-
};
|
|
9479
|
-
const setOSInfo = (info) => {
|
|
9480
|
-
osInfo = info;
|
|
9481
|
-
};
|
|
9482
|
-
const getOSInfo = () => {
|
|
9483
|
-
return osInfo;
|
|
9484
|
-
};
|
|
9485
|
-
const setDeviceInfo = (info) => {
|
|
9486
|
-
deviceInfo = info;
|
|
9487
|
-
};
|
|
9488
|
-
const getDeviceInfo = () => {
|
|
9489
|
-
return deviceInfo;
|
|
9490
|
-
};
|
|
9491
|
-
const getClientDetails = () => {
|
|
9492
|
-
if (isReactNative()) {
|
|
9493
|
-
// Since RN doesn't support web, sharing browser info is not required
|
|
9494
|
-
return {
|
|
9495
|
-
sdk: getSdkInfo(),
|
|
9496
|
-
os: getOSInfo(),
|
|
9497
|
-
device: getDeviceInfo(),
|
|
9498
|
-
};
|
|
9499
|
-
}
|
|
9500
|
-
const userAgent = new UAParser(navigator.userAgent);
|
|
9501
|
-
const { browser, os, device, cpu } = userAgent.getResult();
|
|
9502
|
-
return {
|
|
9503
|
-
sdk: getSdkInfo(),
|
|
9504
|
-
browser: {
|
|
9505
|
-
name: browser.name || navigator.userAgent,
|
|
9506
|
-
version: browser.version || '',
|
|
9507
|
-
},
|
|
9508
|
-
os: {
|
|
9509
|
-
name: os.name || '',
|
|
9510
|
-
version: os.version || '',
|
|
9511
|
-
architecture: cpu.architecture || '',
|
|
9512
|
-
},
|
|
9513
|
-
device: {
|
|
9514
|
-
name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
|
|
9515
|
-
version: '',
|
|
9516
|
-
},
|
|
9517
|
-
};
|
|
9518
|
-
};
|
|
9519
|
-
|
|
9520
9528
|
class InputMediaDeviceManagerState {
|
|
9521
|
-
constructor() {
|
|
9529
|
+
constructor(disableMode = 'stop-tracks') {
|
|
9530
|
+
this.disableMode = disableMode;
|
|
9522
9531
|
this.statusSubject = new BehaviorSubject(undefined);
|
|
9523
9532
|
this.mediaStreamSubject = new BehaviorSubject(undefined);
|
|
9524
9533
|
this.selectedDeviceSubject = new BehaviorSubject(undefined);
|
|
@@ -9545,7 +9554,9 @@ class InputMediaDeviceManagerState {
|
|
|
9545
9554
|
this.selectedDevice$ = this.selectedDeviceSubject
|
|
9546
9555
|
.asObservable()
|
|
9547
9556
|
.pipe(distinctUntilChanged$1());
|
|
9548
|
-
this.status$ = this.statusSubject
|
|
9557
|
+
this.status$ = this.statusSubject
|
|
9558
|
+
.asObservable()
|
|
9559
|
+
.pipe(distinctUntilChanged$1());
|
|
9549
9560
|
}
|
|
9550
9561
|
/**
|
|
9551
9562
|
* The device status
|
|
@@ -9593,7 +9604,7 @@ class InputMediaDeviceManagerState {
|
|
|
9593
9604
|
|
|
9594
9605
|
class CameraManagerState extends InputMediaDeviceManagerState {
|
|
9595
9606
|
constructor() {
|
|
9596
|
-
super();
|
|
9607
|
+
super('stop-tracks');
|
|
9597
9608
|
this.directionSubject = new BehaviorSubject(undefined);
|
|
9598
9609
|
this.direction$ = this.directionSubject
|
|
9599
9610
|
.asObservable()
|
|
@@ -9906,12 +9917,13 @@ class InputMediaDeviceManager {
|
|
|
9906
9917
|
if (this.state.status === 'enabled') {
|
|
9907
9918
|
return;
|
|
9908
9919
|
}
|
|
9909
|
-
yield this.
|
|
9920
|
+
yield this.unmuteStream();
|
|
9910
9921
|
this.state.setStatus('enabled');
|
|
9911
9922
|
});
|
|
9912
9923
|
}
|
|
9913
9924
|
/**
|
|
9914
9925
|
* Stops camera/microphone
|
|
9926
|
+
*
|
|
9915
9927
|
* @returns
|
|
9916
9928
|
*/
|
|
9917
9929
|
disable() {
|
|
@@ -9919,12 +9931,25 @@ class InputMediaDeviceManager {
|
|
|
9919
9931
|
if (this.state.status === 'disabled') {
|
|
9920
9932
|
return;
|
|
9921
9933
|
}
|
|
9922
|
-
|
|
9934
|
+
this.state.prevStatus = this.state.status;
|
|
9935
|
+
yield this.muteStream(this.state.disableMode === 'stop-tracks');
|
|
9923
9936
|
this.state.setStatus('disabled');
|
|
9924
9937
|
});
|
|
9925
9938
|
}
|
|
9939
|
+
/**
|
|
9940
|
+
* If status was previously enabled, it will reenable the device.
|
|
9941
|
+
*/
|
|
9942
|
+
resume() {
|
|
9943
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9944
|
+
if (this.state.prevStatus === 'enabled' &&
|
|
9945
|
+
this.state.status === 'disabled') {
|
|
9946
|
+
this.enable();
|
|
9947
|
+
}
|
|
9948
|
+
});
|
|
9949
|
+
}
|
|
9926
9950
|
/**
|
|
9927
9951
|
* If current device statis is disabled, it will enable the device, else it will disable it.
|
|
9952
|
+
*
|
|
9928
9953
|
* @returns
|
|
9929
9954
|
*/
|
|
9930
9955
|
toggle() {
|
|
@@ -9959,32 +9984,40 @@ class InputMediaDeviceManager {
|
|
|
9959
9984
|
applySettingsToStream() {
|
|
9960
9985
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9961
9986
|
if (this.state.status === 'enabled') {
|
|
9962
|
-
yield this.
|
|
9963
|
-
yield this.
|
|
9987
|
+
yield this.muteStream();
|
|
9988
|
+
yield this.unmuteStream();
|
|
9964
9989
|
}
|
|
9965
9990
|
});
|
|
9966
9991
|
}
|
|
9967
|
-
|
|
9992
|
+
muteStream(stopTracks = true) {
|
|
9968
9993
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9969
9994
|
if (!this.state.mediaStream) {
|
|
9970
9995
|
return;
|
|
9971
9996
|
}
|
|
9972
9997
|
if (this.call.state.callingState === CallingState.JOINED) {
|
|
9973
|
-
yield this.stopPublishStream();
|
|
9998
|
+
yield this.stopPublishStream(stopTracks);
|
|
9974
9999
|
}
|
|
9975
10000
|
else if (this.state.mediaStream) {
|
|
9976
|
-
|
|
10001
|
+
stopTracks
|
|
10002
|
+
? disposeOfMediaStream(this.state.mediaStream)
|
|
10003
|
+
: this.muteTracks();
|
|
10004
|
+
}
|
|
10005
|
+
if (stopTracks) {
|
|
10006
|
+
this.state.setMediaStream(undefined);
|
|
9977
10007
|
}
|
|
9978
|
-
this.state.setMediaStream(undefined);
|
|
9979
10008
|
});
|
|
9980
10009
|
}
|
|
9981
|
-
|
|
10010
|
+
unmuteStream() {
|
|
9982
10011
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10012
|
+
let stream;
|
|
9983
10013
|
if (this.state.mediaStream) {
|
|
9984
|
-
|
|
10014
|
+
stream = this.state.mediaStream;
|
|
10015
|
+
this.unmuteTracks();
|
|
10016
|
+
}
|
|
10017
|
+
else {
|
|
10018
|
+
const constraints = { deviceId: this.state.selectedDevice };
|
|
10019
|
+
stream = yield this.getStream(constraints);
|
|
9985
10020
|
}
|
|
9986
|
-
const constraints = { deviceId: this.state.selectedDevice };
|
|
9987
|
-
const stream = yield this.getStream(constraints);
|
|
9988
10021
|
if (this.call.state.callingState === CallingState.JOINED) {
|
|
9989
10022
|
yield this.publishStream(stream);
|
|
9990
10023
|
}
|
|
@@ -10036,30 +10069,23 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10036
10069
|
publishStream(stream) {
|
|
10037
10070
|
return this.call.publishVideoStream(stream);
|
|
10038
10071
|
}
|
|
10039
|
-
stopPublishStream() {
|
|
10040
|
-
return this.call.stopPublish(TrackType.VIDEO);
|
|
10072
|
+
stopPublishStream(stopTracks) {
|
|
10073
|
+
return this.call.stopPublish(TrackType.VIDEO, stopTracks);
|
|
10041
10074
|
}
|
|
10042
|
-
|
|
10043
|
-
* Disables the video tracks of the camera
|
|
10044
|
-
*/
|
|
10045
|
-
pause() {
|
|
10075
|
+
muteTracks() {
|
|
10046
10076
|
var _a;
|
|
10047
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((
|
|
10048
|
-
track.enabled = false;
|
|
10049
|
-
});
|
|
10077
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((t) => (t.enabled = false));
|
|
10050
10078
|
}
|
|
10051
|
-
|
|
10052
|
-
* (Re)enables the video tracks of the camera
|
|
10053
|
-
*/
|
|
10054
|
-
resume() {
|
|
10079
|
+
unmuteTracks() {
|
|
10055
10080
|
var _a;
|
|
10056
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((
|
|
10057
|
-
track.enabled = true;
|
|
10058
|
-
});
|
|
10081
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getVideoTracks().forEach((t) => (t.enabled = true));
|
|
10059
10082
|
}
|
|
10060
10083
|
}
|
|
10061
10084
|
|
|
10062
10085
|
class MicrophoneManagerState extends InputMediaDeviceManagerState {
|
|
10086
|
+
constructor() {
|
|
10087
|
+
super('disable-tracks');
|
|
10088
|
+
}
|
|
10063
10089
|
getDeviceIdFromStream(stream) {
|
|
10064
10090
|
var _a;
|
|
10065
10091
|
return (_a = stream.getAudioTracks()[0]) === null || _a === void 0 ? void 0 : _a.getSettings().deviceId;
|
|
@@ -10079,26 +10105,16 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
10079
10105
|
publishStream(stream) {
|
|
10080
10106
|
return this.call.publishAudioStream(stream);
|
|
10081
10107
|
}
|
|
10082
|
-
stopPublishStream() {
|
|
10083
|
-
return this.call.stopPublish(TrackType.AUDIO);
|
|
10108
|
+
stopPublishStream(stopTracks) {
|
|
10109
|
+
return this.call.stopPublish(TrackType.AUDIO, stopTracks);
|
|
10084
10110
|
}
|
|
10085
|
-
|
|
10086
|
-
* Disables the audio tracks of the microphone
|
|
10087
|
-
*/
|
|
10088
|
-
pause() {
|
|
10111
|
+
muteTracks() {
|
|
10089
10112
|
var _a;
|
|
10090
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((
|
|
10091
|
-
track.enabled = false;
|
|
10092
|
-
});
|
|
10113
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((t) => (t.enabled = false));
|
|
10093
10114
|
}
|
|
10094
|
-
|
|
10095
|
-
* (Re)enables the audio tracks of the microphone
|
|
10096
|
-
*/
|
|
10097
|
-
resume() {
|
|
10115
|
+
unmuteTracks() {
|
|
10098
10116
|
var _a;
|
|
10099
|
-
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((
|
|
10100
|
-
track.enabled = true;
|
|
10101
|
-
});
|
|
10117
|
+
(_a = this.state.mediaStream) === null || _a === void 0 ? void 0 : _a.getAudioTracks().forEach((t) => (t.enabled = true));
|
|
10102
10118
|
}
|
|
10103
10119
|
}
|
|
10104
10120
|
|
|
@@ -10662,11 +10678,12 @@ class Call {
|
|
|
10662
10678
|
*
|
|
10663
10679
|
*
|
|
10664
10680
|
* @param trackType the track type to stop publishing.
|
|
10681
|
+
* @param stopTrack if `true` the track will be stopped, else it will be just disabled
|
|
10665
10682
|
*/
|
|
10666
|
-
this.stopPublish = (trackType) => __awaiter(this, void 0, void 0, function* () {
|
|
10683
|
+
this.stopPublish = (trackType, stopTrack = true) => __awaiter(this, void 0, void 0, function* () {
|
|
10667
10684
|
var _j;
|
|
10668
10685
|
this.logger('info', `stopPublish ${TrackType[trackType]}`);
|
|
10669
|
-
yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType));
|
|
10686
|
+
yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType, stopTrack));
|
|
10670
10687
|
});
|
|
10671
10688
|
/**
|
|
10672
10689
|
* Update track subscription configuration for one or more participants.
|
|
@@ -12439,7 +12456,7 @@ class WSConnectionFallback {
|
|
|
12439
12456
|
}
|
|
12440
12457
|
}
|
|
12441
12458
|
|
|
12442
|
-
const version = '0.3.
|
|
12459
|
+
const version = '0.3.3';
|
|
12443
12460
|
|
|
12444
12461
|
const logger = getLogger(['location']);
|
|
12445
12462
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -13493,5 +13510,5 @@ var browsers = /*#__PURE__*/Object.freeze({
|
|
|
13493
13510
|
isSafari: isSafari
|
|
13494
13511
|
});
|
|
13495
13512
|
|
|
13496
|
-
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 };
|
|
13513
|
+
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 };
|
|
13497
13514
|
//# sourceMappingURL=index.es.js.map
|