@bigbinary/neeto-media-recorder 2.7.47 → 2.7.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-media-recorder",
3
- "version": "2.7.47",
3
+ "version": "2.7.49",
4
4
  "description": "A package to simplify the media capturing process",
5
5
  "repository": "git@github.com:bigbinary/neeto-media-recorder.git",
6
6
  "license": "MIT",
package/v2/index.js CHANGED
@@ -3,7 +3,7 @@ import { useState, useRef, useCallback, useEffect, forwardRef, useImperativeHand
3
3
  import { Toastr, Typography, Spinner, Callout, Button, Progress, Alert } from '@bigbinary/neeto-atoms';
4
4
  import { useMutation, isCancelledError } from '@tanstack/react-query';
5
5
  import { noop } from '@bigbinary/neeto-cist';
6
- 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, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, IS_EXTENSION as IS_EXTENSION$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
+ 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';
7
7
  import { screenRecorder, useMultipartS3UploadStatus, getMultipartS3Uploader } from '@bigbinary/neeto-media-recorder/core';
8
8
  import PageLoader from '@bigbinary/neeto-molecules/v2/PageLoader';
9
9
  import { Trans, useTranslation } from 'react-i18next';
@@ -945,7 +945,16 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
945
945
  return _ref4.apply(this, arguments);
946
946
  };
947
947
  }();
948
- if (typeof window.ClipboardItem === "function" && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.write) {
948
+
949
+ // The gesture-preserving ClipboardItem path only works when this runs
950
+ // synchronously inside a user gesture in the focused recorder document.
951
+ // In the Chrome extension the recorder lives in a background options page
952
+ // and "stop" arrives via chrome.runtime.onMessage (from the toolbar content
953
+ // script / shortcut), so there is no transient user activation to preserve —
954
+ // navigator.clipboard.write always rejects there. Route the extension to the
955
+ // deferred copyToClipboard fallback instead, which succeeds in the focused
956
+ // options page (writeText, with a document.execCommand fallback).
957
+ if (!IS_EXTENSION$1 && typeof window.ClipboardItem === "function" && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.write) {
949
958
  var linkBlobPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
950
959
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
951
960
  while (1) switch (_context3.prev = _context3.next) {
@@ -995,10 +1004,11 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
995
1004
  return;
996
1005
  }
997
1006
 
998
- // Legacy fallback for browsers without ClipboardItem (e.g. Firefox < 127).
999
- // These browsers don't enforce Safari's strict gesture requirement, so a
1000
- // deferred async write is acceptable. copyToClipboard handles its own
1001
- // success toastr and falls back to document.execCommand internally.
1007
+ // Deferred fallback for the Chrome extension and for browsers without
1008
+ // ClipboardItem (e.g. Firefox < 127). Neither enforces Safari's strict
1009
+ // gesture requirement, so a deferred async write is acceptable.
1010
+ // copyToClipboard handles its own success toastr and falls back to
1011
+ // document.execCommand internally.
1002
1012
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
1003
1013
  var link;
1004
1014
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -2392,8 +2402,24 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2392
2402
  case 8:
2393
2403
  createRecordingPromise.current = null;
2394
2404
  case 9:
2405
+ // On the web the link is copied by handleStopRecording (the Controls
2406
+ // Stop button's onClick). In the extension the recorder runs in the
2407
+ // background options page and "stop" arrives via an external
2408
+ // screenRecorder.stopRecording() (relayed from the toolbar/shortcut),
2409
+ // so that button — and its copy — never fires. Trigger the copy here
2410
+ // on the stop event instead. copyRecordingLinkToClipboardOnStop routes
2411
+ // the extension to its deferred fallback (no user gesture to drive
2412
+ // navigator.clipboard.write).
2413
+ if (IS_EXTENSION) {
2414
+ copyRecordingLinkToClipboardOnStop({
2415
+ createRecordingPromise: createRecordingPromise,
2416
+ recordingRef: recordingRef,
2417
+ baseURLRef: baseURLRef,
2418
+ successMessage: t("neetoMediaRecorder.record.copyToClipboardToastrMessage")
2419
+ });
2420
+ }
2395
2421
  multipartS3Uploader.completeUpload();
2396
- case 10:
2422
+ case 11:
2397
2423
  case "end":
2398
2424
  return _context4.stop();
2399
2425
  }