Options
All
  • Public
  • Public/Protected
  • All
Menu

The MediaSourceFactory helps creating URLs that can be used for the src attribute of

The major feature of the MediaSourceFactory is that it can detect if the resource can be streamed and if that is the case, use the Media Source Extensions API (MSE) to stream the media. This means that only a small part of the resource needs to be downloaded in order for playback to start.

Example:

const mediaSourceFactory = new MediaSourceFactory(resourceProvider); mediaSourceFactory.createUrl({ element: audioElement, ... }).then(mediaSourceUrl => { audioElement.src = mediaSourceUrl; })

Hierarchy

  • IMediaSourceFactory

Implemented by

Index

Methods

createUrl

  • Creates an URL that can be assigned to an

    Call revokeUrl() to release the resources allocated by the URL instance.

    Parameters

    • mediaElement: HTMLMediaElement

      The audio or video element to create an URL for.

    • resourceUrl: string | URL

      The URL to the media resource.

    Returns IMediaSourceFactoryCreateUrlResult

destroy

  • destroy(): void
  • Destroys this factory and revokes all URLs created with this factory.

    Returns void

revokeUrl

  • revokeUrl(mediaSourceId: number): void
  • Revokes the specified URL, previously created with createUrl()

    Parameters

    • mediaSourceId: number

      the ID for the URL that was returned from createUrl()

    Returns void

Generated using TypeDoc