Options
All
  • Public
  • Public/Protected
  • All
Menu

Closed Captions element.

description

Using <track> tags, this class allows the displaying of both local and remote captions bypassing CORS, and without the use of the crossorigin attribute.

see

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track

see

https://www.html5rocks.com/en/tutorials/track/basics/

class

Captions

implements

PlayerComponent

Hierarchy

  • Captions

Implements

Index

Constructors

constructor

Properties

Private button

button: HTMLButtonElement

Button to toggle captions.

type

HTMLButtonElement

memberof

Captions

Private captions

captions: HTMLDivElement

Container to display captions.

type

HTMLDivElement

memberof

Captions

Private current

current: TextTrack

Current track (either specified by default attribute or chosen by the user).

type

TextTrack

memberof

Captions

Private default

default: string

Initial language to be used to render captions when turned on, and also as a default value in the Settings component.

see

Captions.addSettings

type

string

memberof

Captions

Private hasTracks

hasTracks: boolean

Whether tracks were found in current media or not.

type

boolean

memberof

Captions

Private player

player: Player

Instance of OpenPlayer.

type

Player

memberof

Captions

Private trackList

trackList: TextTrackList

List of tracks found in current media.

type

TextTrackList

memberof

Captions

Private trackUrlList

trackUrlList: TrackURL

List of remote/local track sources in case no cues are detected natively.

type

TrackURL

memberof

Captions

Private tracks

tracks: CueList

List of cues associated with a specific language.

type

CueList

memberof

Captions

Methods

Private _getCues

  • _getCues(webvttText: string): Cue[]
  • Parse WebVTT text from external domain to emulate native cues

    memberof

    Captions

    Parameters

    • webvttText: string

    Returns Cue[]

Private _hide

  • _hide(): void
  • Turn captions off.

    It removed the class from the captions container to hide any text displayed.

    memberof

    Captions

    Returns void

Private _sanitize

  • _sanitize(html: string): string
  • Clean HTML text.

    Prevents the triggering of script code coming from captions' text, removed styles and also any potential events prefixed with on.

    memberof

    Captions

    Parameters

    • html: string

    Returns string

Private _search

  • _search(tracks: Cue[], currentTime: number): number

Private _show

  • _show(): void
  • Display current caption checking for cues or parsing remote source.

    memberof

    Captions

    Returns void

addSettings

create

  • create(): void

destroy

  • destroy(): void
  • Remove HTML associated to specific OpenPlayer's element.

    This method must include the removal of its previously set events.

    memberof

    PlayerComponent

    Returns void

Object literals

Private events

events: object

Events that will be triggered in Caption element:

  • button (for the caption toggle element)
  • global (for dynamic elements)
  • media (to update captions on timeupdate, instead of using oncuechanged)
type

EventsList

memberof

Captions

button

button: object

Type declaration

global

global: object

Type declaration

media

media: object

Type declaration

Generated using TypeDoc