@stream-io/video-client 0.3.1 → 0.3.2
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 +12 -0
- package/dist/index.browser.es.js +71 -69
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +72 -68
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +71 -69
- package/dist/index.es.js.map +1 -1
- package/dist/src/devices/index.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/devices/index.ts +2 -0
- package/src/rtc/Publisher.ts +11 -19
- package/src/rtc/videoLayers.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.3.2](https://github.com/GetStream/stream-video-js/compare/client0.3.1...client0.3.2) (2023-08-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **client:** export missing classes ([#943](https://github.com/GetStream/stream-video-js/issues/943)) ([2964eb1](https://github.com/GetStream/stream-video-js/commit/2964eb16c405b7b7020ef9bfda81183f28e40b6b))
|
|
16
|
+
|
|
5
17
|
### [0.3.1](https://github.com/GetStream/stream-video-js/compare/client0.3.0...client0.3.1) (2023-08-16)
|
|
6
18
|
|
|
7
19
|
|
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.
|
|
@@ -6619,9 +6680,9 @@ class Publisher {
|
|
|
6619
6680
|
});
|
|
6620
6681
|
};
|
|
6621
6682
|
this.updateVideoPublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
|
|
6622
|
-
var
|
|
6683
|
+
var _b;
|
|
6623
6684
|
logger$3('info', 'Update publish quality, requested rids by SFU:', enabledRids);
|
|
6624
|
-
const videoSender = (
|
|
6685
|
+
const videoSender = (_b = this.transceiverRegistry[TrackType.VIDEO]) === null || _b === void 0 ? void 0 : _b.sender;
|
|
6625
6686
|
if (!videoSender) {
|
|
6626
6687
|
logger$3('warn', 'Update publish quality, no video sender found.');
|
|
6627
6688
|
return;
|
|
@@ -6719,8 +6780,8 @@ class Publisher {
|
|
|
6719
6780
|
* @param options the optional offer options to use.
|
|
6720
6781
|
*/
|
|
6721
6782
|
this.negotiate = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
6722
|
-
var
|
|
6723
|
-
this.isIceRestarting = (
|
|
6783
|
+
var _c;
|
|
6784
|
+
this.isIceRestarting = (_c = options === null || options === void 0 ? void 0 : options.iceRestart) !== null && _c !== void 0 ? _c : false;
|
|
6724
6785
|
const offer = yield this.pc.createOffer(options);
|
|
6725
6786
|
offer.sdp = this.mungeCodecs(offer.sdp);
|
|
6726
6787
|
const trackInfos = this.getCurrentTrackInfos(offer.sdp);
|
|
@@ -6758,15 +6819,6 @@ class Publisher {
|
|
|
6758
6819
|
this.mungeCodecs = (sdp) => {
|
|
6759
6820
|
if (sdp) {
|
|
6760
6821
|
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
6822
|
}
|
|
6771
6823
|
return sdp;
|
|
6772
6824
|
};
|
|
@@ -9464,56 +9516,6 @@ const CallTypes = new CallTypesRegistry([
|
|
|
9464
9516
|
}),
|
|
9465
9517
|
]);
|
|
9466
9518
|
|
|
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
9519
|
class InputMediaDeviceManagerState {
|
|
9518
9520
|
constructor() {
|
|
9519
9521
|
this.statusSubject = new BehaviorSubject(undefined);
|
|
@@ -12435,7 +12437,7 @@ class WSConnectionFallback {
|
|
|
12435
12437
|
}
|
|
12436
12438
|
}
|
|
12437
12439
|
|
|
12438
|
-
const version = '0.3.
|
|
12440
|
+
const version = '0.3.2';
|
|
12439
12441
|
|
|
12440
12442
|
const logger = getLogger(['location']);
|
|
12441
12443
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -13489,5 +13491,5 @@ var browsers = /*#__PURE__*/Object.freeze({
|
|
|
13489
13491
|
isSafari: isSafari
|
|
13490
13492
|
});
|
|
13491
13493
|
|
|
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 };
|
|
13494
|
+
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
13495
|
//# sourceMappingURL=index.browser.es.js.map
|