Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IOptions<T>

Type parameters

  • T

Hierarchy

Index

Properties

Optional end

end: MillisecondsAccepted

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

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 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

url

url: UrlAccepted

The location of the asset to load

Methods

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