formatMediaTime
Media
stable
Convert a duration in seconds to a media-player time string. Short durations use "mm:ss"; durations ≥ 1 hour use "h:mm:ss". Non-finite or negative inputs return "--:--" as a loading placeholder.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- secondsrequirednumber
- Duration in seconds. Non-finite or negative values return "--:--".
API
Return value
The value returned by this util.
- Time string formatted as "mm:ss" (< 1 h) or "h:mm:ss" (≥ 1 h), or "--:--" when input is invalid.
Usage
Examples
Ready-to-paste usage snippets.
Format audio/video durations