MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / handleVolumeAt

Function handleVolumeAt

packages/player/src/controls.ts:187–196  ·  view source on GitHub ↗
(clientX: number)

Source from the content-addressed store, hash-verified

185 let volumeScrubbing = false;
186
187 const handleVolumeAt = (clientX: number) => {
188 const rect = volumeSlider.getBoundingClientRect();
189 const fraction = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
190 currentVolume = fraction;
191 volumeFill.style.width = `${fraction * 100}%`;
192 volumeSlider.setAttribute("aria-valuenow", String(Math.round(fraction * 100)));
193 if (isMuted && fraction > 0) callbacks.onMuteToggle();
194 muteBtn.innerHTML = getVolumeIcon(isMuted, fraction);
195 callbacks.onVolumeChange(fraction);
196 };
197
198 volumeSlider.addEventListener("mousedown", (e) => {
199 e.stopPropagation();

Callers 3

createControlsFunction · 0.85
onVolumeMouseMoveFunction · 0.85
onVolumeTouchMoveFunction · 0.85

Calls 3

getVolumeIconFunction · 0.85
getBoundingClientRectMethod · 0.80
setAttributeMethod · 0.65

Tested by

no test coverage detected