mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 14:41:20 -08:00
10 lines
369 B
TypeScript
10 lines
369 B
TypeScript
export function clampVolume(value: unknown): number {
|
|
return Math.max(0, Math.min(1, Number(value) || 0))
|
|
}
|
|
|
|
export function timeRanges(duration: number, start: number, end: number): TimeRanges {
|
|
if (!duration || Number.isNaN(duration) || end <= 0)
|
|
return { length: 0, start: () => 0, end: () => 0 }
|
|
return { length: 1, start: () => start, end: () => end }
|
|
}
|