gradum-kit - v0.1.0
    Preparing search index...

    Function getVideoDuration

    • Function

      getVideoDuration

      Parameters

      • input: string | Blob

        The video to measure, as a blob or a URL. URLs are fetched anonymously, so a remote server must allow cross-origin reads.

      Returns Promise<number>

      The duration in seconds. Rejects if the metadata cannot be loaded.

      Read how long a video is without displaying it, by loading just its metadata into a detached element. Streams whose duration is not known upfront are handled by seeking to the end to force the browser to resolve it. The element and any temporary object URL are cleaned up before the promise settles.