@remotion/player 4.0.479 → 4.0.482
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.
|
@@ -9,7 +9,7 @@ const render_volume_slider_js_1 = require("./render-volume-slider.js");
|
|
|
9
9
|
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
10
10
|
exports.VOLUME_SLIDER_WIDTH = 100;
|
|
11
11
|
const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
|
|
12
|
-
const [
|
|
12
|
+
const [playerMuted, setPlayerMuted] = remotion_1.Internals.usePlayerMutedState();
|
|
13
13
|
const [mediaVolume, setMediaVolume] = remotion_1.Internals.useMediaVolumeState();
|
|
14
14
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
15
15
|
const parentDivRef = (0, react_1.useRef)(null);
|
|
@@ -28,11 +28,11 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, rend
|
|
|
28
28
|
const onClick = (0, react_1.useCallback)(() => {
|
|
29
29
|
if (isVolume0) {
|
|
30
30
|
setMediaVolume(1);
|
|
31
|
-
|
|
31
|
+
setPlayerMuted(false);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
}, [isVolume0,
|
|
34
|
+
setPlayerMuted((mute) => !mute);
|
|
35
|
+
}, [isVolume0, setPlayerMuted, setMediaVolume]);
|
|
36
36
|
const parentDivStyle = (0, react_1.useMemo)(() => {
|
|
37
37
|
return {
|
|
38
38
|
display: 'inline-flex',
|
|
@@ -62,11 +62,11 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, rend
|
|
|
62
62
|
}, [onBlur, onClick, volumeContainer]);
|
|
63
63
|
const muteButton = (0, react_1.useMemo)(() => {
|
|
64
64
|
return renderMuteButton
|
|
65
|
-
? renderMuteButton({ muted:
|
|
66
|
-
: renderDefaultMuteButton({ muted:
|
|
67
|
-
}, [
|
|
65
|
+
? renderMuteButton({ muted: playerMuted, volume: mediaVolume })
|
|
66
|
+
: renderDefaultMuteButton({ muted: playerMuted, volume: mediaVolume });
|
|
67
|
+
}, [playerMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
|
|
68
68
|
const volumeSlider = (0, react_1.useMemo)(() => {
|
|
69
|
-
return (focused || hover) && !
|
|
69
|
+
return (focused || hover) && !playerMuted && !remotion_1.Internals.isIosSafari()
|
|
70
70
|
? (renderVolumeSlider !== null && renderVolumeSlider !== void 0 ? renderVolumeSlider : render_volume_slider_js_1.renderDefaultVolumeSlider)({
|
|
71
71
|
isVertical: displayVerticalVolumeSlider,
|
|
72
72
|
volume: mediaVolume,
|
|
@@ -79,7 +79,7 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, rend
|
|
|
79
79
|
displayVerticalVolumeSlider,
|
|
80
80
|
focused,
|
|
81
81
|
hover,
|
|
82
|
-
|
|
82
|
+
playerMuted,
|
|
83
83
|
mediaVolume,
|
|
84
84
|
renderVolumeSlider,
|
|
85
85
|
setMediaVolume,
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -74,11 +74,11 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
74
74
|
}, []);
|
|
75
75
|
const player = (0, use_player_js_1.usePlayer)();
|
|
76
76
|
const playerToggle = player.toggle;
|
|
77
|
-
const {
|
|
77
|
+
const { playerMuted, mediaVolume } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
|
|
78
78
|
(0, react_1.useEffect)(() => {
|
|
79
79
|
player.emitter.dispatchVolumeChange(mediaVolume);
|
|
80
80
|
}, [player.emitter, mediaVolume]);
|
|
81
|
-
const isMuted =
|
|
81
|
+
const isMuted = playerMuted || mediaVolume === 0;
|
|
82
82
|
(0, react_1.useEffect)(() => {
|
|
83
83
|
player.emitter.dispatchMuteChange({
|
|
84
84
|
isMuted,
|
|
@@ -201,7 +201,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
201
201
|
}
|
|
202
202
|
player.emitter.dispatchScaleChange(scale);
|
|
203
203
|
}, [player.emitter, scale]);
|
|
204
|
-
const { setMediaVolume,
|
|
204
|
+
const { setMediaVolume, setPlayerMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
205
205
|
const [showBufferIndicator, setShowBufferState] = (0, react_1.useState)(false);
|
|
206
206
|
(0, react_1.useEffect)(() => {
|
|
207
207
|
let timeout = null;
|
|
@@ -280,7 +280,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
280
280
|
requestFullscreen,
|
|
281
281
|
exitFullscreen,
|
|
282
282
|
getVolume: () => {
|
|
283
|
-
if (
|
|
283
|
+
if (playerMuted) {
|
|
284
284
|
return 0;
|
|
285
285
|
}
|
|
286
286
|
return mediaVolume;
|
|
@@ -299,10 +299,10 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
299
299
|
},
|
|
300
300
|
isMuted: () => isMuted,
|
|
301
301
|
mute: () => {
|
|
302
|
-
|
|
302
|
+
setPlayerMuted(true);
|
|
303
303
|
},
|
|
304
304
|
unmute: () => {
|
|
305
|
-
|
|
305
|
+
setPlayerMuted(false);
|
|
306
306
|
},
|
|
307
307
|
getScale: () => scale,
|
|
308
308
|
pauseAndReturnToPlayStart: () => {
|
|
@@ -314,12 +314,12 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
314
314
|
durationInFrames,
|
|
315
315
|
exitFullscreen,
|
|
316
316
|
loop,
|
|
317
|
-
|
|
317
|
+
playerMuted,
|
|
318
318
|
isMuted,
|
|
319
319
|
mediaVolume,
|
|
320
320
|
player,
|
|
321
321
|
requestFullscreen,
|
|
322
|
-
|
|
322
|
+
setPlayerMuted,
|
|
323
323
|
setMediaVolume,
|
|
324
324
|
toggle,
|
|
325
325
|
scale,
|
|
@@ -51,16 +51,17 @@ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext,
|
|
|
51
51
|
fps,
|
|
52
52
|
inputProps,
|
|
53
53
|
]);
|
|
54
|
-
const [
|
|
54
|
+
const [playerMuted, setPlayerMuted] = (0, react_1.useState)(() => initiallyMuted);
|
|
55
55
|
const [mediaVolume, setMediaVolume] = (0, react_1.useState)(() => persistVolumeToStorage
|
|
56
56
|
? (0, volume_persistence_js_1.getPreferredVolume)(volumePersistenceKey !== null && volumePersistenceKey !== void 0 ? volumePersistenceKey : null)
|
|
57
57
|
: initialVolume);
|
|
58
58
|
const mediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
59
59
|
return {
|
|
60
|
-
|
|
60
|
+
playerMuted,
|
|
61
61
|
mediaVolume,
|
|
62
62
|
};
|
|
63
|
-
}, [
|
|
63
|
+
}, [playerMuted, mediaVolume]);
|
|
64
|
+
const shouldCreateAudioContext = audioEnabled && !playerMuted && mediaVolume > 0;
|
|
64
65
|
const setMediaVolumeAndPersist = (0, react_1.useCallback)((vol) => {
|
|
65
66
|
setMediaVolume(vol);
|
|
66
67
|
if (persistVolumeToStorage) {
|
|
@@ -69,7 +70,7 @@ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext,
|
|
|
69
70
|
}, [persistVolumeToStorage, logLevel, volumePersistenceKey]);
|
|
70
71
|
const setMediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
71
72
|
return {
|
|
72
|
-
|
|
73
|
+
setPlayerMuted,
|
|
73
74
|
setMediaVolume: setMediaVolumeAndPersist,
|
|
74
75
|
};
|
|
75
76
|
}, [setMediaVolumeAndPersist]);
|
|
@@ -88,6 +89,6 @@ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext,
|
|
|
88
89
|
isReadOnlyStudio: false,
|
|
89
90
|
};
|
|
90
91
|
}, []);
|
|
91
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: jsx_runtime_1.jsx(remotion_1.Internals.LogLevelContext.Provider, { value: logLevelContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.AbsoluteTimeContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: jsx_runtime_1.jsx(remotion_1.Internals.TimelineContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: jsx_runtime_1.jsx(remotion_1.Internals.PrefetchProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.DurationsContextProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.BufferingProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled:
|
|
92
|
+
return (jsx_runtime_1.jsx(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: jsx_runtime_1.jsx(remotion_1.Internals.LogLevelContext.Provider, { value: logLevelContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.AbsoluteTimeContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: jsx_runtime_1.jsx(remotion_1.Internals.TimelineContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: jsx_runtime_1.jsx(remotion_1.Internals.PrefetchProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.DurationsContextProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.BufferingProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: shouldCreateAudioContext, previewSampleRate: sampleRate, children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
92
93
|
};
|
|
93
94
|
exports.SharedPlayerContexts = SharedPlayerContexts;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1603,7 +1603,7 @@ var renderDefaultVolumeSlider = (props) => {
|
|
|
1603
1603
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1604
1604
|
var VOLUME_SLIDER_WIDTH = 100;
|
|
1605
1605
|
var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
|
|
1606
|
-
const [
|
|
1606
|
+
const [playerMuted, setPlayerMuted] = Internals7.usePlayerMutedState();
|
|
1607
1607
|
const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
|
|
1608
1608
|
const [focused, setFocused] = useState6(false);
|
|
1609
1609
|
const parentDivRef = useRef5(null);
|
|
@@ -1620,11 +1620,11 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1620
1620
|
const onClick = useCallback4(() => {
|
|
1621
1621
|
if (isVolume0) {
|
|
1622
1622
|
setMediaVolume(1);
|
|
1623
|
-
|
|
1623
|
+
setPlayerMuted(false);
|
|
1624
1624
|
return;
|
|
1625
1625
|
}
|
|
1626
|
-
|
|
1627
|
-
}, [isVolume0,
|
|
1626
|
+
setPlayerMuted((mute) => !mute);
|
|
1627
|
+
}, [isVolume0, setPlayerMuted, setMediaVolume]);
|
|
1628
1628
|
const parentDivStyle = useMemo4(() => {
|
|
1629
1629
|
return {
|
|
1630
1630
|
display: "inline-flex",
|
|
@@ -1662,10 +1662,10 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1662
1662
|
});
|
|
1663
1663
|
}, [onBlur, onClick, volumeContainer]);
|
|
1664
1664
|
const muteButton = useMemo4(() => {
|
|
1665
|
-
return renderMuteButton ? renderMuteButton({ muted:
|
|
1666
|
-
}, [
|
|
1665
|
+
return renderMuteButton ? renderMuteButton({ muted: playerMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: playerMuted, volume: mediaVolume });
|
|
1666
|
+
}, [playerMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
|
|
1667
1667
|
const volumeSlider = useMemo4(() => {
|
|
1668
|
-
return (focused || hover) && !
|
|
1668
|
+
return (focused || hover) && !playerMuted && !Internals7.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
|
|
1669
1669
|
isVertical: displayVerticalVolumeSlider,
|
|
1670
1670
|
volume: mediaVolume,
|
|
1671
1671
|
onBlur: () => setFocused(false),
|
|
@@ -1676,7 +1676,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1676
1676
|
displayVerticalVolumeSlider,
|
|
1677
1677
|
focused,
|
|
1678
1678
|
hover,
|
|
1679
|
-
|
|
1679
|
+
playerMuted,
|
|
1680
1680
|
mediaVolume,
|
|
1681
1681
|
renderVolumeSlider,
|
|
1682
1682
|
setMediaVolume
|
|
@@ -2596,11 +2596,11 @@ var PlayerUI = ({
|
|
|
2596
2596
|
}, []);
|
|
2597
2597
|
const player = usePlayer();
|
|
2598
2598
|
const playerToggle = player.toggle;
|
|
2599
|
-
const {
|
|
2599
|
+
const { playerMuted, mediaVolume } = useContext5(Internals11.MediaVolumeContext);
|
|
2600
2600
|
useEffect12(() => {
|
|
2601
2601
|
player.emitter.dispatchVolumeChange(mediaVolume);
|
|
2602
2602
|
}, [player.emitter, mediaVolume]);
|
|
2603
|
-
const isMuted =
|
|
2603
|
+
const isMuted = playerMuted || mediaVolume === 0;
|
|
2604
2604
|
useEffect12(() => {
|
|
2605
2605
|
player.emitter.dispatchMuteChange({
|
|
2606
2606
|
isMuted
|
|
@@ -2709,7 +2709,7 @@ var PlayerUI = ({
|
|
|
2709
2709
|
}
|
|
2710
2710
|
player.emitter.dispatchScaleChange(scale);
|
|
2711
2711
|
}, [player.emitter, scale]);
|
|
2712
|
-
const { setMediaVolume,
|
|
2712
|
+
const { setMediaVolume, setPlayerMuted } = useContext5(Internals11.SetMediaVolumeContext);
|
|
2713
2713
|
const [showBufferIndicator, setShowBufferState] = useState11(false);
|
|
2714
2714
|
useEffect12(() => {
|
|
2715
2715
|
let timeout = null;
|
|
@@ -2783,7 +2783,7 @@ var PlayerUI = ({
|
|
|
2783
2783
|
requestFullscreen,
|
|
2784
2784
|
exitFullscreen,
|
|
2785
2785
|
getVolume: () => {
|
|
2786
|
-
if (
|
|
2786
|
+
if (playerMuted) {
|
|
2787
2787
|
return 0;
|
|
2788
2788
|
}
|
|
2789
2789
|
return mediaVolume;
|
|
@@ -2802,10 +2802,10 @@ var PlayerUI = ({
|
|
|
2802
2802
|
},
|
|
2803
2803
|
isMuted: () => isMuted,
|
|
2804
2804
|
mute: () => {
|
|
2805
|
-
|
|
2805
|
+
setPlayerMuted(true);
|
|
2806
2806
|
},
|
|
2807
2807
|
unmute: () => {
|
|
2808
|
-
|
|
2808
|
+
setPlayerMuted(false);
|
|
2809
2809
|
},
|
|
2810
2810
|
getScale: () => scale,
|
|
2811
2811
|
pauseAndReturnToPlayStart: () => {
|
|
@@ -2817,12 +2817,12 @@ var PlayerUI = ({
|
|
|
2817
2817
|
durationInFrames,
|
|
2818
2818
|
exitFullscreen,
|
|
2819
2819
|
loop,
|
|
2820
|
-
|
|
2820
|
+
playerMuted,
|
|
2821
2821
|
isMuted,
|
|
2822
2822
|
mediaVolume,
|
|
2823
2823
|
player,
|
|
2824
2824
|
requestFullscreen,
|
|
2825
|
-
|
|
2825
|
+
setPlayerMuted,
|
|
2826
2826
|
setMediaVolume,
|
|
2827
2827
|
toggle,
|
|
2828
2828
|
scale
|
|
@@ -3111,14 +3111,15 @@ var SharedPlayerContexts = ({
|
|
|
3111
3111
|
fps,
|
|
3112
3112
|
inputProps
|
|
3113
3113
|
]);
|
|
3114
|
-
const [
|
|
3114
|
+
const [playerMuted, setPlayerMuted] = useState12(() => initiallyMuted);
|
|
3115
3115
|
const [mediaVolume, setMediaVolume] = useState12(() => persistVolumeToStorage ? getPreferredVolume(volumePersistenceKey ?? null) : initialVolume);
|
|
3116
3116
|
const mediaVolumeContextValue = useMemo13(() => {
|
|
3117
3117
|
return {
|
|
3118
|
-
|
|
3118
|
+
playerMuted,
|
|
3119
3119
|
mediaVolume
|
|
3120
3120
|
};
|
|
3121
|
-
}, [
|
|
3121
|
+
}, [playerMuted, mediaVolume]);
|
|
3122
|
+
const shouldCreateAudioContext = audioEnabled && !playerMuted && mediaVolume > 0;
|
|
3122
3123
|
const setMediaVolumeAndPersist = useCallback11((vol) => {
|
|
3123
3124
|
setMediaVolume(vol);
|
|
3124
3125
|
if (persistVolumeToStorage) {
|
|
@@ -3127,7 +3128,7 @@ var SharedPlayerContexts = ({
|
|
|
3127
3128
|
}, [persistVolumeToStorage, logLevel, volumePersistenceKey]);
|
|
3128
3129
|
const setMediaVolumeContextValue = useMemo13(() => {
|
|
3129
3130
|
return {
|
|
3130
|
-
|
|
3131
|
+
setPlayerMuted,
|
|
3131
3132
|
setMediaVolume: setMediaVolumeAndPersist
|
|
3132
3133
|
};
|
|
3133
3134
|
}, [setMediaVolumeAndPersist]);
|
|
@@ -3168,7 +3169,7 @@ var SharedPlayerContexts = ({
|
|
|
3168
3169
|
children: /* @__PURE__ */ jsx13(Internals13.BufferingProvider, {
|
|
3169
3170
|
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioContextProvider, {
|
|
3170
3171
|
audioLatencyHint,
|
|
3171
|
-
audioEnabled,
|
|
3172
|
+
audioEnabled: shouldCreateAudioContext,
|
|
3172
3173
|
previewSampleRate: sampleRate,
|
|
3173
3174
|
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioTagsContextProvider, {
|
|
3174
3175
|
numberOfAudioTags: numberOfSharedAudioTags,
|
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.482",
|
|
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.482"
|
|
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.3.6",
|
|
52
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.482",
|
|
53
53
|
"eslint": "9.19.0",
|
|
54
54
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
55
55
|
},
|