@stream-io/video-client 0.4.2 → 0.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/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +44 -23
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +44 -23
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +44 -23
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/devices/devices.ts +49 -17
- package/src/rtc/Publisher.ts +2 -4
package/dist/index.es.js
CHANGED
|
@@ -6567,11 +6567,8 @@ class Publisher {
|
|
|
6567
6567
|
? transceiver.sender.track.stop()
|
|
6568
6568
|
: (transceiver.sender.track.enabled = false);
|
|
6569
6569
|
// We don't need to notify SFU if unpublishing in response to remote soft mute
|
|
6570
|
-
if (
|
|
6571
|
-
|
|
6572
|
-
}
|
|
6573
|
-
else {
|
|
6574
|
-
return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6570
|
+
if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
|
|
6571
|
+
await this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6575
6572
|
}
|
|
6576
6573
|
}
|
|
6577
6574
|
};
|
|
@@ -9959,22 +9956,43 @@ const CallTypes = new CallTypesRegistry([
|
|
|
9959
9956
|
}),
|
|
9960
9957
|
]);
|
|
9961
9958
|
|
|
9962
|
-
|
|
9959
|
+
/**
|
|
9960
|
+
* Returns an Observable that emits the list of available devices
|
|
9961
|
+
* that meet the given constraints.
|
|
9962
|
+
*
|
|
9963
|
+
* @param constraints the constraints to use when requesting the devices.
|
|
9964
|
+
* @param kind the kind of devices to enumerate.
|
|
9965
|
+
*/
|
|
9966
|
+
const getDevices = (constraints, kind) => {
|
|
9963
9967
|
return new Observable((subscriber) => {
|
|
9964
|
-
|
|
9965
|
-
.
|
|
9966
|
-
|
|
9967
|
-
// in
|
|
9968
|
-
//
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9968
|
+
const enumerate = async () => {
|
|
9969
|
+
let devices = await navigator.mediaDevices.enumerateDevices();
|
|
9970
|
+
// some browsers report empty device labels (Firefox).
|
|
9971
|
+
// in that case, we need to request permissions (via getUserMedia)
|
|
9972
|
+
// to be able to get the device labels
|
|
9973
|
+
const needsGetUserMedia = devices.some((device) => device.kind === kind && device.label === '');
|
|
9974
|
+
if (needsGetUserMedia) {
|
|
9975
|
+
let mediaStream;
|
|
9976
|
+
try {
|
|
9977
|
+
mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
9978
|
+
devices = await navigator.mediaDevices.enumerateDevices();
|
|
9979
|
+
}
|
|
9980
|
+
finally {
|
|
9981
|
+
if (mediaStream)
|
|
9982
|
+
disposeOfMediaStream(mediaStream);
|
|
9983
|
+
}
|
|
9984
|
+
}
|
|
9985
|
+
return devices;
|
|
9986
|
+
};
|
|
9987
|
+
enumerate()
|
|
9988
|
+
.then((devices) => {
|
|
9989
|
+
// notify subscribers and complete
|
|
9990
|
+
subscriber.next(devices);
|
|
9991
|
+
subscriber.complete();
|
|
9975
9992
|
})
|
|
9976
9993
|
.catch((error) => {
|
|
9977
|
-
getLogger(['devices'])
|
|
9994
|
+
const logger = getLogger(['devices']);
|
|
9995
|
+
logger('error', 'Failed to enumerate devices', error);
|
|
9978
9996
|
subscriber.error(error);
|
|
9979
9997
|
});
|
|
9980
9998
|
});
|
|
@@ -9988,7 +10006,7 @@ const checkIfAudioOutputChangeSupported = () => {
|
|
|
9988
10006
|
if (typeof document === 'undefined')
|
|
9989
10007
|
return false;
|
|
9990
10008
|
const element = document.createElement('audio');
|
|
9991
|
-
return
|
|
10009
|
+
return 'setSinkId' in element;
|
|
9992
10010
|
};
|
|
9993
10011
|
/**
|
|
9994
10012
|
* The default constraints used to request audio devices.
|
|
@@ -10039,10 +10057,13 @@ const getDeviceChangeObserver = memoizedObservable(() => {
|
|
|
10039
10057
|
}).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay(1));
|
|
10040
10058
|
});
|
|
10041
10059
|
const getAudioDevicesObserver = memoizedObservable(() => {
|
|
10042
|
-
return merge(getDevices(audioDeviceConstraints), getDeviceChangeObserver()).pipe(shareReplay(1));
|
|
10060
|
+
return merge(getDevices(audioDeviceConstraints, 'audioinput'), getDeviceChangeObserver()).pipe(shareReplay(1));
|
|
10061
|
+
});
|
|
10062
|
+
const getAudioOutputDevicesObserver = memoizedObservable(() => {
|
|
10063
|
+
return merge(getDevices(audioDeviceConstraints, 'audiooutput'), getDeviceChangeObserver()).pipe(shareReplay(1));
|
|
10043
10064
|
});
|
|
10044
10065
|
const getVideoDevicesObserver = memoizedObservable(() => {
|
|
10045
|
-
return merge(getDevices(videoDeviceConstraints), getDeviceChangeObserver()).pipe(shareReplay(1));
|
|
10066
|
+
return merge(getDevices(videoDeviceConstraints, 'videoinput'), getDeviceChangeObserver()).pipe(shareReplay(1));
|
|
10046
10067
|
});
|
|
10047
10068
|
/**
|
|
10048
10069
|
* Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
|
|
@@ -10060,7 +10081,7 @@ const getVideoDevices = () => {
|
|
|
10060
10081
|
* Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audiooutput' devices, if devices are added/removed the list is updated. Selecting 'audiooutput' device only makes sense if [the browser has support for changing audio output on 'audio' elements](#checkifaudiooutputchangesupported)
|
|
10061
10082
|
*/
|
|
10062
10083
|
const getAudioOutputDevices = () => {
|
|
10063
|
-
return
|
|
10084
|
+
return getAudioOutputDevicesObserver().pipe(map$1((values) => values.filter((d) => d.kind === 'audiooutput')));
|
|
10064
10085
|
};
|
|
10065
10086
|
const getStream = async (constraints) => {
|
|
10066
10087
|
try {
|
|
@@ -13943,7 +13964,7 @@ class StreamClient {
|
|
|
13943
13964
|
});
|
|
13944
13965
|
};
|
|
13945
13966
|
this.getUserAgent = () => {
|
|
13946
|
-
const version = "0.4.
|
|
13967
|
+
const version = "0.4.3" ;
|
|
13947
13968
|
return (this.userAgent ||
|
|
13948
13969
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
13949
13970
|
};
|