@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.cjs.js
CHANGED
|
@@ -6587,11 +6587,8 @@ class Publisher {
|
|
|
6587
6587
|
? transceiver.sender.track.stop()
|
|
6588
6588
|
: (transceiver.sender.track.enabled = false);
|
|
6589
6589
|
// We don't need to notify SFU if unpublishing in response to remote soft mute
|
|
6590
|
-
if (
|
|
6591
|
-
|
|
6592
|
-
}
|
|
6593
|
-
else {
|
|
6594
|
-
return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6590
|
+
if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
|
|
6591
|
+
await this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
6595
6592
|
}
|
|
6596
6593
|
}
|
|
6597
6594
|
};
|
|
@@ -9979,22 +9976,43 @@ const CallTypes = new CallTypesRegistry([
|
|
|
9979
9976
|
}),
|
|
9980
9977
|
]);
|
|
9981
9978
|
|
|
9982
|
-
|
|
9979
|
+
/**
|
|
9980
|
+
* Returns an Observable that emits the list of available devices
|
|
9981
|
+
* that meet the given constraints.
|
|
9982
|
+
*
|
|
9983
|
+
* @param constraints the constraints to use when requesting the devices.
|
|
9984
|
+
* @param kind the kind of devices to enumerate.
|
|
9985
|
+
*/
|
|
9986
|
+
const getDevices = (constraints, kind) => {
|
|
9983
9987
|
return new rxjs.Observable((subscriber) => {
|
|
9984
|
-
|
|
9985
|
-
.
|
|
9986
|
-
|
|
9987
|
-
// in
|
|
9988
|
-
//
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9988
|
+
const enumerate = async () => {
|
|
9989
|
+
let devices = await navigator.mediaDevices.enumerateDevices();
|
|
9990
|
+
// some browsers report empty device labels (Firefox).
|
|
9991
|
+
// in that case, we need to request permissions (via getUserMedia)
|
|
9992
|
+
// to be able to get the device labels
|
|
9993
|
+
const needsGetUserMedia = devices.some((device) => device.kind === kind && device.label === '');
|
|
9994
|
+
if (needsGetUserMedia) {
|
|
9995
|
+
let mediaStream;
|
|
9996
|
+
try {
|
|
9997
|
+
mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
9998
|
+
devices = await navigator.mediaDevices.enumerateDevices();
|
|
9999
|
+
}
|
|
10000
|
+
finally {
|
|
10001
|
+
if (mediaStream)
|
|
10002
|
+
disposeOfMediaStream(mediaStream);
|
|
10003
|
+
}
|
|
10004
|
+
}
|
|
10005
|
+
return devices;
|
|
10006
|
+
};
|
|
10007
|
+
enumerate()
|
|
10008
|
+
.then((devices) => {
|
|
10009
|
+
// notify subscribers and complete
|
|
10010
|
+
subscriber.next(devices);
|
|
10011
|
+
subscriber.complete();
|
|
9995
10012
|
})
|
|
9996
10013
|
.catch((error) => {
|
|
9997
|
-
getLogger(['devices'])
|
|
10014
|
+
const logger = getLogger(['devices']);
|
|
10015
|
+
logger('error', 'Failed to enumerate devices', error);
|
|
9998
10016
|
subscriber.error(error);
|
|
9999
10017
|
});
|
|
10000
10018
|
});
|
|
@@ -10008,7 +10026,7 @@ const checkIfAudioOutputChangeSupported = () => {
|
|
|
10008
10026
|
if (typeof document === 'undefined')
|
|
10009
10027
|
return false;
|
|
10010
10028
|
const element = document.createElement('audio');
|
|
10011
|
-
return
|
|
10029
|
+
return 'setSinkId' in element;
|
|
10012
10030
|
};
|
|
10013
10031
|
/**
|
|
10014
10032
|
* The default constraints used to request audio devices.
|
|
@@ -10059,10 +10077,13 @@ const getDeviceChangeObserver = memoizedObservable(() => {
|
|
|
10059
10077
|
}).pipe(rxjs.debounceTime(500), rxjs.concatMap(() => rxjs.from(navigator.mediaDevices.enumerateDevices())), rxjs.shareReplay(1));
|
|
10060
10078
|
});
|
|
10061
10079
|
const getAudioDevicesObserver = memoizedObservable(() => {
|
|
10062
|
-
return rxjs.merge(getDevices(audioDeviceConstraints), getDeviceChangeObserver()).pipe(rxjs.shareReplay(1));
|
|
10080
|
+
return rxjs.merge(getDevices(audioDeviceConstraints, 'audioinput'), getDeviceChangeObserver()).pipe(rxjs.shareReplay(1));
|
|
10081
|
+
});
|
|
10082
|
+
const getAudioOutputDevicesObserver = memoizedObservable(() => {
|
|
10083
|
+
return rxjs.merge(getDevices(audioDeviceConstraints, 'audiooutput'), getDeviceChangeObserver()).pipe(rxjs.shareReplay(1));
|
|
10063
10084
|
});
|
|
10064
10085
|
const getVideoDevicesObserver = memoizedObservable(() => {
|
|
10065
|
-
return rxjs.merge(getDevices(videoDeviceConstraints), getDeviceChangeObserver()).pipe(rxjs.shareReplay(1));
|
|
10086
|
+
return rxjs.merge(getDevices(videoDeviceConstraints, 'videoinput'), getDeviceChangeObserver()).pipe(rxjs.shareReplay(1));
|
|
10066
10087
|
});
|
|
10067
10088
|
/**
|
|
10068
10089
|
* 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.
|
|
@@ -10080,7 +10101,7 @@ const getVideoDevices = () => {
|
|
|
10080
10101
|
* 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)
|
|
10081
10102
|
*/
|
|
10082
10103
|
const getAudioOutputDevices = () => {
|
|
10083
|
-
return
|
|
10104
|
+
return getAudioOutputDevicesObserver().pipe(rxjs.map((values) => values.filter((d) => d.kind === 'audiooutput')));
|
|
10084
10105
|
};
|
|
10085
10106
|
const getStream = async (constraints) => {
|
|
10086
10107
|
try {
|
|
@@ -13963,7 +13984,7 @@ class StreamClient {
|
|
|
13963
13984
|
});
|
|
13964
13985
|
};
|
|
13965
13986
|
this.getUserAgent = () => {
|
|
13966
|
-
const version = "0.4.
|
|
13987
|
+
const version = "0.4.3" ;
|
|
13967
13988
|
return (this.userAgent ||
|
|
13968
13989
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
13969
13990
|
};
|