Function createSourceElements

  • Creates an array of HTMLSourceElement elements from a list of URLs. Useful for providing native browser fallback for video and audio elements, where the browser automatically tries the next when one fails.

    Parameters

    • urls: (string | URL)[]

      Ordered list of blob URLs to try

    • Optional type: string

      Optional MIME type to set on each source element (e.g. "video/mp4", "audio/ogg")

    Returns HTMLSourceElement[]

    Array of HTMLSourceElement elements