@bigbinary/neeto-media-recorder 2.7.47 → 2.7.48
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/index.js +33 -7
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/v2/index.js +33 -7
- package/v2/index.js.map +1 -1
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { shallow } from 'zustand/shallow';
|
|
|
2
2
|
import { useState, useRef, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useMutation, isCancelledError } from '@tanstack/react-query';
|
|
4
4
|
import { noop } from '@bigbinary/neeto-cist';
|
|
5
|
-
import { ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, SCREEN_RECORDER_STATUS, UPLOAD_STATUS as UPLOAD_STATUS$1, MIME_TYPE as MIME_TYPE$1,
|
|
5
|
+
import { ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, SCREEN_RECORDER_STATUS, UPLOAD_STATUS as UPLOAD_STATUS$1, MIME_TYPE as MIME_TYPE$1, IS_EXTENSION as IS_EXTENSION$1, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, COUNTDOWN_TIME, MIC_NOT_WORKING_SILENCE_TIMEOUT, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
|
|
6
6
|
import { screenRecorder, useMultipartS3UploadStatus, getMultipartS3Uploader } from '@bigbinary/neeto-media-recorder/core';
|
|
7
7
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
8
8
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
@@ -735,7 +735,16 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
|
|
|
735
735
|
return _ref4.apply(this, arguments);
|
|
736
736
|
};
|
|
737
737
|
}();
|
|
738
|
-
|
|
738
|
+
|
|
739
|
+
// The gesture-preserving ClipboardItem path only works when this runs
|
|
740
|
+
// synchronously inside a user gesture in the focused recorder document.
|
|
741
|
+
// In the Chrome extension the recorder lives in a background options page
|
|
742
|
+
// and "stop" arrives via chrome.runtime.onMessage (from the toolbar content
|
|
743
|
+
// script / shortcut), so there is no transient user activation to preserve —
|
|
744
|
+
// navigator.clipboard.write always rejects there. Route the extension to the
|
|
745
|
+
// deferred copyToClipboard fallback instead, which succeeds in the focused
|
|
746
|
+
// options page (writeText, with a document.execCommand fallback).
|
|
747
|
+
if (!IS_EXTENSION$1 && typeof window.ClipboardItem === "function" && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.write) {
|
|
739
748
|
var linkBlobPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
740
749
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
741
750
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -785,10 +794,11 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
|
|
|
785
794
|
return;
|
|
786
795
|
}
|
|
787
796
|
|
|
788
|
-
//
|
|
789
|
-
//
|
|
790
|
-
// deferred async write is acceptable.
|
|
791
|
-
// success toastr and falls back to
|
|
797
|
+
// Deferred fallback for the Chrome extension and for browsers without
|
|
798
|
+
// ClipboardItem (e.g. Firefox < 127). Neither enforces Safari's strict
|
|
799
|
+
// gesture requirement, so a deferred async write is acceptable.
|
|
800
|
+
// copyToClipboard handles its own success toastr and falls back to
|
|
801
|
+
// document.execCommand internally.
|
|
792
802
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
793
803
|
var link;
|
|
794
804
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
@@ -2408,8 +2418,24 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
|
|
|
2408
2418
|
case 8:
|
|
2409
2419
|
createRecordingPromise.current = null;
|
|
2410
2420
|
case 9:
|
|
2421
|
+
// On the web the link is copied by handleStopRecording (the Controls
|
|
2422
|
+
// Stop button's onClick). In the extension the recorder runs in the
|
|
2423
|
+
// background options page and "stop" arrives via an external
|
|
2424
|
+
// screenRecorder.stopRecording() (relayed from the toolbar/shortcut),
|
|
2425
|
+
// so that button — and its copy — never fires. Trigger the copy here
|
|
2426
|
+
// on the stop event instead. copyRecordingLinkToClipboardOnStop routes
|
|
2427
|
+
// the extension to its deferred fallback (no user gesture to drive
|
|
2428
|
+
// navigator.clipboard.write).
|
|
2429
|
+
if (IS_EXTENSION) {
|
|
2430
|
+
copyRecordingLinkToClipboardOnStop({
|
|
2431
|
+
createRecordingPromise: createRecordingPromise,
|
|
2432
|
+
recordingRef: recordingRef,
|
|
2433
|
+
baseURLRef: baseURLRef,
|
|
2434
|
+
successMessage: t("neetoMediaRecorder.record.copyToClipboardToastrMessage")
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2411
2437
|
multipartS3Uploader.completeUpload();
|
|
2412
|
-
case
|
|
2438
|
+
case 11:
|
|
2413
2439
|
case "end":
|
|
2414
2440
|
return _context4.stop();
|
|
2415
2441
|
}
|