Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/runtime/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ export function initSandboxRuntimeModular(): void {
if (!(el instanceof HTMLMediaElement)) continue;
const parsed = parseFloat(el.dataset.volume ?? "");
const clipVolume = Number.isFinite(parsed) ? parsed : 1;
el.volume = clipVolume * volume;
el.volume = Math.max(0, Math.min(1, clipVolume * volume));
}
},
onSetMediaOutputMuted: (muted) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/runtime/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function syncRuntimeMedia(params: {
}
}
const userVol = params.userVolume ?? 1;
el.volume = (clip.volume ?? 1) * userVol;
el.volume = Math.max(0, Math.min(1, (clip.volume ?? 1) * userVol));
if (shouldMute) el.muted = true;
// Ensure full preload for every active media element. Streaming
// formats (MP3) may arrive with preload="metadata", which only
Expand Down
4 changes: 2 additions & 2 deletions packages/player/src/parent-media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ParentMediaManager {
}

updateVolume(volume: number): void {
for (const m of this._entries) m.el.volume = volume;
for (const m of this._entries) m.el.volume = Math.max(0, Math.min(1, volume));
}

updatePlaybackRate(rate: number): void {
Expand Down Expand Up @@ -249,7 +249,7 @@ export class ParentMediaManager {
el.src = src;
el.load();
el.muted = this._getMuted();
el.volume = this._getVolume();
el.volume = Math.max(0, Math.min(1, this._getVolume()));
const rate = this._getPlaybackRate();
if (rate !== 1) el.playbackRate = rate;

Expand Down
Loading