Options
All
  • Public
  • Public/Protected
  • All
Menu

Accurate Player Plugins API

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

ChannelRouter

ChannelRouter: (channelCount: number, outputCount: number) => RouteMap

Function declaration to enable custom default routing behaviour.

Takes the auidio tracks channelCount and the outputCount and return an appropriate route map for the configuration.

Type declaration

    • (channelCount: number, outputCount: number): RouteMap
    • Parameters

      • channelCount: number
      • outputCount: number

      Returns RouteMap

ImageResolver

ImageResolver: (background: string) => string

Type declaration

    • (background: string): string
    • Parameters

      • background: string

      Returns string

PointValidator

PointValidator: (points: { in?: Point; out?: Point }, emitEvent: <T>(event: T) => void) => boolean

Type of point validator, implement and register to PointPlugin to create custom validation.

param

The points that are attempted to be added.

param

Callback to trigger custom event on plugin. For instance if validation failed.

returns

True if points is allowed, false otherwise.

Type declaration

    • (points: { in?: Point; out?: Point }, emitEvent: <T>(event: T) => void): boolean
    • Parameters

      • points: { in?: Point; out?: Point }
      • emitEvent: <T>(event: T) => void
          • <T>(event: T): void
          • Type parameters

            • T: PlayerEvent

            Parameters

            • event: T

            Returns void

      Returns boolean

RouteMap

RouteMap: number[][]

Represents a route map. The map is a matrix where the rows represent incoming channels and the columns represent the destination channels, i.e output speaker.

Example: an stereo track with a stereo output would have the following default routing layout

            L   R
Channel 0 [ 1 , 0 ]
Channel 1 [ 0 , 1 ]

Which would connect the audio tracks first (left) channel to the second (right) destination channel.

Example: an 5.1 track with a 5.1 output would have the following default routing layout

            L   R   C  LFE  LS  RS
Channel 0 [ 1 , 0 , 0 , 0 , 0 , 0 ]
Channel 1 [ 0 , 1 , 0 , 0 , 0 , 0 ]
Channel 2 [ 0 , 0 , 1 , 0 , 0 , 0 ]
Channel 3 [ 0 , 0 , 0 , 1 , 0 , 0 ]
Channel 4 [ 0 , 0 , 0 , 0 , 1 , 0 ]
Channel 5 [ 0 , 0 , 0 , 0 , 0 , 1 ]

StyleAttrType

StyleAttrType: number | string | boolean | ComputedLength

TTMLStringReference

TTMLStringReference: TTMLFileReference & { xmlString: string }

updateCallback

updateCallback: (currentFrame: number, previousFrame?: number) => void

Interface for the callback used by the plugin.

  • currentFrame The current frame.
  • previousFrame The frame from the previous call.

Type declaration

    • (currentFrame: number, previousFrame?: number): void
    • Parameters

      • currentFrame: number
      • Optional previousFrame: number

      Returns void

Variables

Const AUDIO_SCRUB_PLUGIN_NAME

AUDIO_SCRUB_PLUGIN_NAME: "apAudioScrubPlugin" = "apAudioScrubPlugin"

Const AudioScrubEventType

AudioScrubEventType: { Added: string; PostPause: string; PostPlay: string; PrePause: string; PrePlay: string; Removed: string } = ...

Type declaration

  • Added: string
  • PostPause: string
  • PostPlay: string
  • PrePause: string
  • PrePlay: string
  • Removed: string

Const CHANNEL_CONTROL_PLUGIN_NAME

CHANNEL_CONTROL_PLUGIN_NAME: "apChannelControlPlugin" = "apChannelControlPlugin"

Const ChannelControlEventType

ChannelControlEventType: { Added: string; ChannelChanged: string; ContextCreated: string; ElementInitialized: string; Error: string; MasterOutputVolumeChanged: string; Removed: string; RouteChanged: string } = ...

Type declaration

  • Added: string
  • ChannelChanged: string
  • ContextCreated: string
  • ElementInitialized: string
  • Error: string
  • MasterOutputVolumeChanged: string
  • Removed: string
  • RouteChanged: string

Const DEFAULT_CHANNEL_CONTROL_SETTINGS

DEFAULT_CHANNEL_CONTROL_SETTINGS: ChannelSettings = ...

Const DEFAULT_TIME_UPDATE_SETTINGS

DEFAULT_TIME_UPDATE_SETTINGS: SmoothTimeUpdateSettings = ...

Const DISCRETE_AUDIO_PLUGIN_NAME

DISCRETE_AUDIO_PLUGIN_NAME: "apDiscreteAudioPlugin" = "apDiscreteAudioPlugin"

Const DiscreteAudioEventType

DiscreteAudioEventType: { Added: string; Error: string; OffsetChanged: string; Removed: string; SourceChanged: string } = ...

Type declaration

  • Added: string
  • Error: string
  • OffsetChanged: string
  • Removed: string
  • SourceChanged: string

Const HOTKEY_PLUGIN_NAME

HOTKEY_PLUGIN_NAME: "apHotkeyPlugin" = "apHotkeyPlugin"

Const HotkeyEventType

HotkeyEventType: { Error: string; KeyPressed: string; Updated: string } = ...

Type declaration

  • Error: string
  • KeyPressed: string
  • Updated: string

Const IMSC_SUBTITLE_PLUGIN_NAME

IMSC_SUBTITLE_PLUGIN_NAME: "apImscSubtitlePlugin" = "apImscSubtitlePlugin"

Const ImscSubtitleEventType

ImscSubtitleEventType: { Change: string; CloseTag: string; Error: string; Load: string; OpenTag: string; Text: string } = ...

Type declaration

  • Change: string
  • CloseTag: string
  • Error: string
  • Load: string
  • OpenTag: string
  • Text: string

Const POINT_PLUGIN_NAME

POINT_PLUGIN_NAME: "apPointPlugin" = "apPointPlugin"

Const PointEventType

PointEventType: { Added: string; Error: string; Removed: string; ValidationFailed: string } = ...

Type declaration

  • Added: string
  • Error: string
  • Removed: string
  • ValidationFailed: string

Const SHADOW_PREFIX

SHADOW_PREFIX: "-shadow" = "-shadow"

Const SMOOTH_TIME_UPDATE_PLUGIN_NAME

SMOOTH_TIME_UPDATE_PLUGIN_NAME: "apSmoothTimeUpdatePlugin" = "apSmoothTimeUpdatePlugin"

Const SUBTITLE_PLUGIN_NAME

SUBTITLE_PLUGIN_NAME: "apSubtitlePlugin" = "apSubtitlePlugin"

Const SmoothTimeUpdateEventType

SmoothTimeUpdateEventType: { TimeUpdate: string } = ...

Type declaration

  • TimeUpdate: string

Const SubtitleEventType

SubtitleEventType: { Added: string; Error: string; Removed: string } = ...

Type declaration

  • Added: string
  • Error: string
  • Removed: string

Const VTT_SUBTITLE_PLUGIN_NAME

VTT_SUBTITLE_PLUGIN_NAME: "apVttSubtitlePlugin" = "apVttSubtitlePlugin"

Const VttSubtitleEventType

VttSubtitleEventType: { Added: string; Error: string; Removed: string } = ...

Type declaration

  • Added: string
  • Error: string
  • Removed: string

Functions

RMS

  • RMS(data: Float32Array): number
  • Calculate the root mean square value for one channel at a specific time.

    Parameters

    • data: Float32Array

      The current float time domain data for one channel.

    Returns number

addMissingNamespaces

  • addMissingNamespaces(xmlString: string): string
  • Adds any missing namespaces of TTML specific prefixes included in the specified XML string.

    Parameters

    • xmlString: string

      The TTML XML string.

    Returns string

applyCompatibility

  • applyCompatibility(doc: XMLDocument): void
  • Fixes deprecations and/or imscJS incompatibilites in the specified TTML document.

    Parameters

    • doc: XMLDocument

      The TTML XML document.

    Returns void

createCueFromTimespan

  • createCueFromTimespan - Create a SubtitleCue from a Timespan

    Parameters

    • timespan: Timespan

      the timespan for the cue

    Returns SubtitleCue

createSubtitlesFromTimespans

  • createSubtitlesFromTimespans - Create Subtitles for all timespans that are of subtitle type.

    Parameters

    • timespans: Timespan[]

      the Timespan[] that should be converted into Subtitle[]

    Returns Subtitle[]

dBFS

  • dBFS(value: number, scale?: number): number
  • Calculate a decibel value relative to full scale.

    Parameters

    • value: number

      The value.

    • scale: number = 1

      The reference scale (gain value)

    Returns number

Const defaultValidation

  • defaultValidation(points: { in?: Point; out?: Point }, emitEvent: <T>(event: T) => void): boolean
  • The default validaion logic, will always return true.

    Parameters

    • points: { in?: Point; out?: Point }
    • emitEvent: <T>(event: T) => void
        • <T>(event: T): void
        • Type parameters

          • T: PlayerEvent

          Parameters

          • event: T

          Returns void

    Returns boolean

dispatchOnFrameChange

  • dispatchOnFrameChange(currentFrame: number, previousFrame?: number): void
  • Dispatch a new 'SmoothTimeUpdateEvent' if the currentFrame differs from the previous.

    Parameters

    • currentFrame: number

      The current frame from the player.

    • Optional previousFrame: number

      The frame from the previous check.

    Returns void

extentInPx

  • extentInPx(doc: XMLDocument, renderElement: HTMLElement): string
  • Replaces percentual values with pixel values for the tts:extent attribute.

    Parameters

    • doc: XMLDocument

      The TTML XML document.

    • renderElement: HTMLElement

      The element that will render the subtitles.

    Returns string

extractText

  • extractText(isd: ISD): string | null
  • Returns the accumulated text content from the specified ISD in form of a single string.

    Parameters

    • isd: ISD

      The ISD object.

    Returns string | null

findSubtitleIndex

  • findSubtitleIndex(subtitleTracks: Subtitle[], trackSubtitle: Subtitle): number
  • findSubtitleIndex - find the index for trackSubtitle in the subtitleTracks array. returns -1 if trackSubtitle cannot be found.

    Parameters

    • subtitleTracks: Subtitle[]

      the list of subtitles to search in

    • trackSubtitle: Subtitle

      the subtitle that should be found

    Returns number

isSameSubtitle

  • isSameSubtitle - compares two subtitles and return true if they are considered to be the same.

    Parameters

    • subtitleA: Subtitle

      first subtitle to compare

    • subtitleB: Subtitle

      seconds subtitle to compare

    Returns boolean

Const startBeforeEndValidator

  • startBeforeEndValidator(points: { in?: Point; out?: Point }, emitEvent: <T>(event: T) => void): boolean
  • Validator to force in point to be less or equal to out point. Will trigger a PointValidationFailedEvent event if validation fails.

    Parameters

    • points: { in?: Point; out?: Point }

      The points that are attempted to be added.

    • emitEvent: <T>(event: T) => void

      Callback to trigger custom event.

        • <T>(event: T): void
        • Type parameters

          • T: PlayerEvent

          Parameters

          • event: T

          Returns void

    Returns boolean

timeFloatDomainToRMSdB

  • timeFloatDomainToRMSdB(data: Float32Array[], scale?: number): number[]
  • Map time domain data to a RMS value in dB relative to fullscale (1).

    Parameters

    • data: Float32Array[]

      The current time domain data from the channels.

    • scale: number = 1

      The reference scale (gain value)

    Returns number[]

    Return the db value for each channel, (-inf, 0).