@stream-io/video-client 1.25.5 → 1.26.1
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 +27 -10
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +27 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +27 -10
- package/dist/index.es.js.map +1 -1
- package/dist/src/helpers/RNSpeechDetector.d.ts +2 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/helpers/DynascaleManager.ts +6 -0
- package/src/helpers/RNSpeechDetector.ts +20 -6
package/dist/index.cjs.js
CHANGED
|
@@ -5812,7 +5812,7 @@ const aggregate = (stats) => {
|
|
|
5812
5812
|
return report;
|
|
5813
5813
|
};
|
|
5814
5814
|
|
|
5815
|
-
const version = "1.
|
|
5815
|
+
const version = "1.26.1";
|
|
5816
5816
|
const [major, minor, patch] = version.split('.');
|
|
5817
5817
|
let sdkInfo = {
|
|
5818
5818
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -9038,6 +9038,12 @@ class DynascaleManager {
|
|
|
9038
9038
|
if (context.state === 'suspended') {
|
|
9039
9039
|
document.addEventListener('click', this.resumeAudioContext);
|
|
9040
9040
|
}
|
|
9041
|
+
// @ts-expect-error audioSession is available in Safari only
|
|
9042
|
+
const audioSession = navigator.audioSession;
|
|
9043
|
+
if (audioSession) {
|
|
9044
|
+
// https://github.com/w3c/audio-session/blob/main/explainer.md
|
|
9045
|
+
audioSession.type = 'play-and-record';
|
|
9046
|
+
}
|
|
9041
9047
|
return (this.audioContext = context);
|
|
9042
9048
|
};
|
|
9043
9049
|
this.resumeAudioContext = () => {
|
|
@@ -10537,20 +10543,26 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
|
|
|
10537
10543
|
};
|
|
10538
10544
|
|
|
10539
10545
|
class RNSpeechDetector {
|
|
10540
|
-
constructor() {
|
|
10546
|
+
constructor(externalAudioStream) {
|
|
10541
10547
|
this.pc1 = new RTCPeerConnection({});
|
|
10542
10548
|
this.pc2 = new RTCPeerConnection({});
|
|
10549
|
+
this.externalAudioStream = externalAudioStream;
|
|
10543
10550
|
}
|
|
10544
10551
|
/**
|
|
10545
10552
|
* Starts the speech detection.
|
|
10546
10553
|
*/
|
|
10547
10554
|
async start(onSoundDetectedStateChanged) {
|
|
10548
10555
|
try {
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
}
|
|
10553
|
-
|
|
10556
|
+
let audioStream;
|
|
10557
|
+
if (this.externalAudioStream != null) {
|
|
10558
|
+
audioStream = this.externalAudioStream;
|
|
10559
|
+
}
|
|
10560
|
+
else {
|
|
10561
|
+
audioStream = await navigator.mediaDevices.getUserMedia({
|
|
10562
|
+
audio: true,
|
|
10563
|
+
});
|
|
10564
|
+
this.audioStream = audioStream;
|
|
10565
|
+
}
|
|
10554
10566
|
this.pc1.addEventListener('icecandidate', async (e) => {
|
|
10555
10567
|
await this.pc2.addIceCandidate(e.candidate);
|
|
10556
10568
|
});
|
|
@@ -10592,7 +10604,12 @@ class RNSpeechDetector {
|
|
|
10592
10604
|
stop() {
|
|
10593
10605
|
this.pc1.close();
|
|
10594
10606
|
this.pc2.close();
|
|
10595
|
-
this.
|
|
10607
|
+
if (this.externalAudioStream != null) {
|
|
10608
|
+
this.externalAudioStream = undefined;
|
|
10609
|
+
}
|
|
10610
|
+
else {
|
|
10611
|
+
this.cleanupAudioStream();
|
|
10612
|
+
}
|
|
10596
10613
|
}
|
|
10597
10614
|
/**
|
|
10598
10615
|
* Public method that detects the audio levels and returns the status.
|
|
@@ -14284,7 +14301,7 @@ class StreamClient {
|
|
|
14284
14301
|
this.getUserAgent = () => {
|
|
14285
14302
|
if (!this.cachedUserAgent) {
|
|
14286
14303
|
const { clientAppIdentifier = {} } = this.options;
|
|
14287
|
-
const { sdkName = 'js', sdkVersion = "1.
|
|
14304
|
+
const { sdkName = 'js', sdkVersion = "1.26.1", ...extras } = clientAppIdentifier;
|
|
14288
14305
|
this.cachedUserAgent = [
|
|
14289
14306
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
14290
14307
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|
|
@@ -14863,6 +14880,7 @@ exports.MicrophoneManager = MicrophoneManager;
|
|
|
14863
14880
|
exports.MicrophoneManagerState = MicrophoneManagerState;
|
|
14864
14881
|
exports.NoiseCancellationSettingsModeEnum = NoiseCancellationSettingsModeEnum;
|
|
14865
14882
|
exports.OwnCapability = OwnCapability;
|
|
14883
|
+
exports.RNSpeechDetector = RNSpeechDetector;
|
|
14866
14884
|
exports.RTMPBroadcastRequestQualityEnum = RTMPBroadcastRequestQualityEnum;
|
|
14867
14885
|
exports.RTMPSettingsRequestQualityEnum = RTMPSettingsRequestQualityEnum;
|
|
14868
14886
|
exports.RecordSettingsRequestModeEnum = RecordSettingsRequestModeEnum;
|