( parent: ShadowRoot, muted: boolean, volume: number, speedPresetsAttr: string | null, callbacks: ControlsCallbacks, audioLocked = false, )
| 15 | * must be enforced by the caller — this function always constructs. |
| 16 | */ |
| 17 | export function setupControls( |
| 18 | parent: ShadowRoot, |
| 19 | muted: boolean, |
| 20 | volume: number, |
| 21 | speedPresetsAttr: string | null, |
| 22 | callbacks: ControlsCallbacks, |
| 23 | audioLocked = false, |
| 24 | ): ReturnType<typeof createControls> { |
| 25 | const speedPresets = speedPresetsAttr |
| 26 | ? speedPresetsAttr |
| 27 | .split(",") |
| 28 | .map(Number) |
| 29 | .filter((n) => !isNaN(n) && n > 0) |
| 30 | : undefined; |
| 31 | const options: ControlsOptions = { |
| 32 | ...(speedPresets ? { speedPresets } : {}), |
| 33 | audioLocked, |
| 34 | }; |
| 35 | const api = createControls(parent, callbacks, options); |
| 36 | api.updateMuted(muted); |
| 37 | api.updateVolume(volume); |
| 38 | return api; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Set up or remove the poster image element in `parent`. |
no test coverage detected