Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

Index

Properties

Optional disableFocus

disableFocus: undefined | false | true

Prevent a video from stealing the audio focus, causing other playing audio on the device to stop.

Optional end

end: MillisecondsAccepted

Where the media should stop playing or loop at. Implementations should default this to Infinity

height

height: number

The height the media should render at. Any implementation should render the media in coverage style; the media should cover the full height, even if it cuts off parts of the width

Optional loop

loop: undefined | false | true

Determines if the media should loop when end is reached. Implementations should default this to false

Optional positionInterval

positionInterval: MillisecondsAccepted

If supported, the onPositionChange function will only be invoked when the duration has changed by this interval or is seeked to a new position

Optional poster

poster: UrlAccepted

An optional poster image that can be displayed whilst the video buffers. Setting a poster will resolve the onLoad callback once the image is loaded (or video, whichever is first). Essentially, the onLoad callback is a callback to the DOM component to denote that it can now show the element.

Optional start

start: MillisecondsAccepted

The starting point that the media should play at. The media should reset to this position when stopped or looping. Implementations should default this to 0

Optional state

The inital state of the media. The default is State.Stopped. Setting it to State.Buffering will start buffering the data (if supported). State.Playing will start the media as soon as it is possible to. It is highly likely that setting the initial state to State.Playing will result in a initial state of State.Buffering until there is enough data to actually play

Optional theme

theme: ITheme

url

url: UrlAccepted

The location of the asset to load

width

width: number

The width the media should render at. Any implementation should render the media in coverage style; the media should cover the full width, even if it cuts off parts of the height

Methods

Optional onDimensions

  • onDimensions(dimensions: IWidthHeight): void
  • Invoked when the dimensions of the media is known. Not this can be invoked before the media is loaded as the dimensions can often be read from the header data of the media source

    Parameters

    • dimensions: IWidthHeight

      the current state of the media

    Returns void

Optional onDuration

  • onDuration(duration: Milliseconds): void

Optional onError

  • onError(error: Error, resource: T): void
  • Invoked when the media creates a loading error or another fatal error

    Parameters

    • error: Error

      the error that occurred

    • resource: T

      the resource

    Returns void

Optional onLoad

  • onLoad(resource: T): void
  • Invoked when the resource has completed loading

    Parameters

    • resource: T

      the loaded resource

    Returns void

Optional onPosition

  • onPosition(position: Milliseconds): void
  • Will be invoked whenever the position of the media changes. This will be updated at positionInterval intervals

    Parameters

    • position: Milliseconds

      the current location in the media, will be relative to start

    Returns void

Optional onProgress

  • onProgress(percentage: number): void
  • Provides progress updates on the loading resource.

    Parameters

    • percentage: number

      values in the range [0, 1]

    Returns void

Optional onStateChange

  • onStateChange(state: State): void
  • Invoked whenever the playable state of the media changes. This can be used to update the visual state of UI components

    Parameters

    • state: State

      the current state of the media

    Returns void