Skip to content

Decrease ad volume by 75%#239

Merged
Jayian1890 merged 2 commits intoOpenCloudGaming:devfrom
Jayian1890:fix/decrease-ad-volume
Apr 11, 2026
Merged

Decrease ad volume by 75%#239
Jayian1890 merged 2 commits intoOpenCloudGaming:devfrom
Jayian1890:fix/decrease-ad-volume

Conversation

@Jayian1890
Copy link
Copy Markdown
Collaborator

Adjust the ad playback volume to a quarter of the original level, ensuring that the original volume can be restored when playback ends.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts renderer-side queue ad playback to reduce audio volume during ad preview playback, with the intent to restore the prior volume afterward.

Changes:

  • Captures the video element’s initial volume in a ref and scales playback volume to 25%.
  • Attempts to restore the captured volume in the effect cleanup when the ad preview is torn down.

Comment on lines +176 to +181
if (originalVolumeRef.current === null) {
originalVolumeRef.current = video.volume;
}
try {
video.volume = Math.max(0, Math.min(1, (originalVolumeRef.current ?? 1) * 0.25));
} catch {
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originalVolumeRef is only captured once for the lifetime of the component (it never resets when mediaUrl changes). If the element volume is modified between ads (or by the browser), subsequent ads will scale from a stale value and the cleanup will restore to the old volume. Consider capturing the original volume per-mediaUrl (e.g., reset the ref to null when mediaUrl changes, or keep originalVolume as a local variable in this effect and restore from that in cleanup).

Copilot uses AI. Check for mistakes.
@Jayian1890 Jayian1890 merged commit c648609 into OpenCloudGaming:dev Apr 11, 2026
5 checks passed
@Jayian1890 Jayian1890 deleted the fix/decrease-ad-volume branch April 11, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants