@remotion/player 4.0.506 → 4.0.508
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/dist/cjs/use-playback.js +20 -4
- package/dist/esm/index.mjs +18 -4
- package/package.json +3 -3
package/dist/cjs/use-playback.js
CHANGED
|
@@ -29,6 +29,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
29
29
|
const { pause, emitter, isPlaying } = (0, use_player_methods_js_1.usePlayerMethods)();
|
|
30
30
|
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
31
31
|
const sharedAudioContext = (0, react_2.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
32
|
+
const { setPlayerMuted } = (0, react_2.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
32
33
|
const logLevel = remotion_1.Internals.useLogLevel();
|
|
33
34
|
// requestAnimationFrame() does not work if the tab is not active.
|
|
34
35
|
// This means that audio will keep playing even if it has ended.
|
|
@@ -119,6 +120,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
122
|
let hasBeenStopped = false;
|
|
123
|
+
let audioContextFailed = false;
|
|
122
124
|
let reqAnimFrameCall = null;
|
|
123
125
|
let startedTime = performance.now();
|
|
124
126
|
let framesAdvanced = 0;
|
|
@@ -145,7 +147,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
145
147
|
(_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
|
|
146
148
|
return;
|
|
147
149
|
}
|
|
148
|
-
if (!muted && !context.buffering.current) {
|
|
150
|
+
if (!muted && !audioContextFailed && !context.buffering.current) {
|
|
149
151
|
(_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
|
|
150
152
|
}
|
|
151
153
|
const time = performance.now() - startedTime;
|
|
@@ -179,9 +181,22 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
179
181
|
const queueNextFrame = () => {
|
|
180
182
|
var _a, _b;
|
|
181
183
|
var _c;
|
|
182
|
-
|
|
184
|
+
if (hasBeenStopped) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const getIsResumingAudioContext = audioContextFailed
|
|
188
|
+
? null
|
|
189
|
+
: ((_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);
|
|
183
190
|
if (getIsResumingAudioContext !== null && !muted) {
|
|
184
|
-
getIsResumingAudioContext.then(() => {
|
|
191
|
+
getIsResumingAudioContext.then((result) => {
|
|
192
|
+
if (hasBeenStopped) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (result === 'failed') {
|
|
196
|
+
audioContextFailed = true;
|
|
197
|
+
sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend();
|
|
198
|
+
setPlayerMuted(true);
|
|
199
|
+
}
|
|
185
200
|
startedTime = performance.now();
|
|
186
201
|
framesAdvanced = 0;
|
|
187
202
|
queueNextFrame();
|
|
@@ -189,7 +204,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
189
204
|
return;
|
|
190
205
|
}
|
|
191
206
|
if (context.buffering.current) {
|
|
192
|
-
if (!muted) {
|
|
207
|
+
if (!muted && !audioContextFailed) {
|
|
193
208
|
(_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
|
|
194
209
|
}
|
|
195
210
|
const stopListening = context.listenForResume(() => {
|
|
@@ -241,6 +256,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
241
256
|
context,
|
|
242
257
|
isPlaying,
|
|
243
258
|
sharedAudioContext,
|
|
259
|
+
setPlayerMuted,
|
|
244
260
|
logLevel,
|
|
245
261
|
muted,
|
|
246
262
|
]);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1026,6 +1026,7 @@ var usePlayback = ({
|
|
|
1026
1026
|
const { pause, emitter, isPlaying } = usePlayerMethods();
|
|
1027
1027
|
const setFrame = Internals8.Timeline.useTimelineSetFrame();
|
|
1028
1028
|
const sharedAudioContext = useContext4(Internals8.SharedAudioContext);
|
|
1029
|
+
const { setPlayerMuted } = useContext4(Internals8.SetMediaVolumeContext);
|
|
1029
1030
|
const logLevel = Internals8.useLogLevel();
|
|
1030
1031
|
const isBackgroundedRef = useIsBackgrounded();
|
|
1031
1032
|
const lastTimeUpdateTimestamp = useRef5(0);
|
|
@@ -1108,6 +1109,7 @@ var usePlayback = ({
|
|
|
1108
1109
|
return;
|
|
1109
1110
|
}
|
|
1110
1111
|
let hasBeenStopped = false;
|
|
1112
|
+
let audioContextFailed = false;
|
|
1111
1113
|
let reqAnimFrameCall = null;
|
|
1112
1114
|
let startedTime = performance.now();
|
|
1113
1115
|
let framesAdvanced = 0;
|
|
@@ -1132,7 +1134,7 @@ var usePlayback = ({
|
|
|
1132
1134
|
sharedAudioContext?.suspend?.();
|
|
1133
1135
|
return;
|
|
1134
1136
|
}
|
|
1135
|
-
if (!muted && !context.buffering.current) {
|
|
1137
|
+
if (!muted && !audioContextFailed && !context.buffering.current) {
|
|
1136
1138
|
sharedAudioContext?.resume?.();
|
|
1137
1139
|
}
|
|
1138
1140
|
const time = performance.now() - startedTime;
|
|
@@ -1162,9 +1164,20 @@ var usePlayback = ({
|
|
|
1162
1164
|
queueNextFrame();
|
|
1163
1165
|
};
|
|
1164
1166
|
const queueNextFrame = () => {
|
|
1165
|
-
|
|
1167
|
+
if (hasBeenStopped) {
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
const getIsResumingAudioContext = audioContextFailed ? null : sharedAudioContext?.getIsResumingAudioContext?.() ?? null;
|
|
1166
1171
|
if (getIsResumingAudioContext !== null && !muted) {
|
|
1167
|
-
getIsResumingAudioContext.then(() => {
|
|
1172
|
+
getIsResumingAudioContext.then((result) => {
|
|
1173
|
+
if (hasBeenStopped) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (result === "failed") {
|
|
1177
|
+
audioContextFailed = true;
|
|
1178
|
+
sharedAudioContext?.suspend();
|
|
1179
|
+
setPlayerMuted(true);
|
|
1180
|
+
}
|
|
1168
1181
|
startedTime = performance.now();
|
|
1169
1182
|
framesAdvanced = 0;
|
|
1170
1183
|
queueNextFrame();
|
|
@@ -1172,7 +1185,7 @@ var usePlayback = ({
|
|
|
1172
1185
|
return;
|
|
1173
1186
|
}
|
|
1174
1187
|
if (context.buffering.current) {
|
|
1175
|
-
if (!muted) {
|
|
1188
|
+
if (!muted && !audioContextFailed) {
|
|
1176
1189
|
sharedAudioContext?.suspend?.();
|
|
1177
1190
|
}
|
|
1178
1191
|
const stopListening = context.listenForResume(() => {
|
|
@@ -1221,6 +1234,7 @@ var usePlayback = ({
|
|
|
1221
1234
|
context,
|
|
1222
1235
|
isPlaying,
|
|
1223
1236
|
sharedAudioContext,
|
|
1237
|
+
setPlayerMuted,
|
|
1224
1238
|
logLevel,
|
|
1225
1239
|
muted
|
|
1226
1240
|
]);
|
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.
|
|
6
|
+
"version": "4.0.508",
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"remotion": "4.0.
|
|
38
|
+
"remotion": "4.0.508"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": "19.2.3",
|
|
50
50
|
"webpack": "5.105.0",
|
|
51
51
|
"zod": "4.4.3",
|
|
52
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.508",
|
|
53
53
|
"eslint": "9.19.0",
|
|
54
54
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
55
55
|
},
|