@remotion/player 4.0.456 → 4.0.457

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.
@@ -95,7 +95,9 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
95
95
  (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
96
96
  return;
97
97
  }
98
- (_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
98
+ if (!muted) {
99
+ (_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
100
+ }
99
101
  const time = performance.now() - startedTime;
100
102
  const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : config.durationInFrames - 1;
101
103
  const actualFirstFrame = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
@@ -127,7 +129,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
127
129
  var _a, _b;
128
130
  var _c;
129
131
  const getIsResumingAudioContext = (_c = (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.getIsResumingAudioContext) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext)) !== null && _c !== void 0 ? _c : null;
130
- if (getIsResumingAudioContext !== null) {
132
+ if (getIsResumingAudioContext !== null && !muted) {
131
133
  getIsResumingAudioContext.then(() => {
132
134
  if (!(sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.audioContext)) {
133
135
  return;
@@ -0,0 +1,2 @@
1
+ export declare const persistVolume: (volume: number, logLevel: "error" | "info" | "trace" | "verbose" | "warn", volumePersistenceKey: string | null) => void;
2
+ export declare const getPreferredVolume: (volumePersistenceKey: string | null) => number;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPreferredVolume = exports.persistVolume = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const DEFAULT_VOLUME_PERSISTANCE_KEY = 'remotion.volumePreference';
6
+ const persistVolume = (volume, logLevel, volumePersistenceKey) => {
7
+ if (typeof window === 'undefined') {
8
+ return;
9
+ }
10
+ try {
11
+ window.localStorage.setItem(volumePersistenceKey !== null && volumePersistenceKey !== void 0 ? volumePersistenceKey : DEFAULT_VOLUME_PERSISTANCE_KEY, String(volume));
12
+ }
13
+ catch (e) {
14
+ // User can disallow localStorage access
15
+ // https://github.com/remotion-dev/remotion/issues/3540
16
+ remotion_1.Internals.Log.error({ logLevel, tag: null }, 'Could not persist volume', e);
17
+ }
18
+ };
19
+ exports.persistVolume = persistVolume;
20
+ const getPreferredVolume = (volumePersistenceKey) => {
21
+ if (typeof window === 'undefined') {
22
+ return 1;
23
+ }
24
+ try {
25
+ const val = window.localStorage.getItem(volumePersistenceKey !== null && volumePersistenceKey !== void 0 ? volumePersistenceKey : DEFAULT_VOLUME_PERSISTANCE_KEY);
26
+ return val ? Number(val) : 1;
27
+ }
28
+ catch (_a) {
29
+ // User can disallow localStorage access
30
+ // https://github.com/remotion-dev/remotion/issues/3540
31
+ return 1;
32
+ }
33
+ };
34
+ exports.getPreferredVolume = getPreferredVolume;
@@ -1016,7 +1016,9 @@ var usePlayback = ({
1016
1016
  sharedAudioContext?.suspend?.();
1017
1017
  return;
1018
1018
  }
1019
- sharedAudioContext?.resume?.();
1019
+ if (!muted) {
1020
+ sharedAudioContext?.resume?.();
1021
+ }
1020
1022
  const time = performance.now() - startedTime;
1021
1023
  const actualLastFrame = outFrame ?? config.durationInFrames - 1;
1022
1024
  const actualFirstFrame = inFrame ?? 0;
@@ -1045,7 +1047,7 @@ var usePlayback = ({
1045
1047
  };
1046
1048
  const queueNextFrame = () => {
1047
1049
  const getIsResumingAudioContext = sharedAudioContext?.getIsResumingAudioContext?.() ?? null;
1048
- if (getIsResumingAudioContext !== null) {
1050
+ if (getIsResumingAudioContext !== null && !muted) {
1049
1051
  getIsResumingAudioContext.then(() => {
1050
1052
  if (!sharedAudioContext?.audioContext) {
1051
1053
  return;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/player"
4
4
  },
5
5
  "name": "@remotion/player",
6
- "version": "4.0.456",
6
+ "version": "4.0.457",
7
7
  "description": "React component for embedding a Remotion preview into your app",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "license": "SEE LICENSE IN LICENSE.md",
38
38
  "dependencies": {
39
- "remotion": "4.0.456"
39
+ "remotion": "4.0.457"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8.0",
@@ -50,7 +50,7 @@
50
50
  "react-dom": "19.2.3",
51
51
  "webpack": "5.105.0",
52
52
  "zod": "4.3.6",
53
- "@remotion/eslint-config-internal": "4.0.456",
53
+ "@remotion/eslint-config-internal": "4.0.457",
54
54
  "eslint": "9.19.0",
55
55
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
56
56
  },