@pexip/media 17.3.0 → 17.4.0
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 +20 -0
- package/dist/audioMixingProcessor.d.ts +18 -0
- package/dist/audioMixingProcessor.js +173 -0
- package/dist/audioProcessor.d.ts +86 -0
- package/dist/audioProcessor.js +310 -0
- package/dist/baseLogger.d.ts +37 -0
- package/dist/baseLogger.js +29 -0
- package/dist/displayMedia.d.ts +3 -0
- package/dist/displayMedia.js +31 -0
- package/dist/index.d.ts +11 -837
- package/dist/index.js +11 -0
- package/dist/logger.d.ts +11 -0
- package/dist/logger.js +44 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.js +296 -0
- package/dist/previewController.d.ts +64 -0
- package/dist/previewController.js +375 -0
- package/dist/signals.d.ts +25 -0
- package/dist/signals.js +38 -0
- package/dist/status.d.ts +35 -0
- package/dist/status.js +199 -0
- package/dist/typeGuard.d.ts +9 -0
- package/dist/typeGuard.js +40 -0
- package/dist/types.d.ts +559 -0
- package/dist/types.js +278 -0
- package/dist/userMedia.d.ts +38 -0
- package/dist/userMedia.js +333 -0
- package/dist/utils.d.ts +108 -0
- package/dist/utils.js +360 -0
- package/dist/videoProcessor.d.ts +56 -0
- package/dist/videoProcessor.js +349 -0
- package/package.json +8 -8
- package/dist/index.mjs +0 -2902
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { limitSharingMonitorInterface, stopMediaStream, } from '@pexip/media-control';
|
|
2
|
+
import { cancellablePromise } from '@pexip/utils';
|
|
3
|
+
export const createGetDisplayMedia = (getDefaultConstraints, getDisplayMedia = constraints => navigator.mediaDevices.getDisplayMedia(constraints)) => {
|
|
4
|
+
const props = {
|
|
5
|
+
requesting: false,
|
|
6
|
+
};
|
|
7
|
+
return async (constraints) => {
|
|
8
|
+
const [getCancelableDisplayMedia, cancel] = cancellablePromise(getDisplayMedia, stream => {
|
|
9
|
+
stopMediaStream(stream);
|
|
10
|
+
});
|
|
11
|
+
if (props.requesting) {
|
|
12
|
+
// Cancel the previous request which has not been finished
|
|
13
|
+
cancel();
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
props.requesting = true;
|
|
17
|
+
const mergedConstraints = {
|
|
18
|
+
...getDefaultConstraints(),
|
|
19
|
+
...constraints,
|
|
20
|
+
};
|
|
21
|
+
const stream = await getCancelableDisplayMedia(mergedConstraints);
|
|
22
|
+
if (!stream) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return limitSharingMonitorInterface(mergedConstraints, stream);
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
props.requesting = false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|