Skip to content

Module: src/ui/Title

The Title component displays the primary and secondary media titles (if available) above the player viewport. It remains hidden when no title data is present or when the feature is disabled. The component automatically updates based on media data and playback language.

Version
1.0.0
Author
Frank Kudermann - alphanull
License
MIT
Requires
DomSmith
Source
Title.js, line 13

Constructor

new Title(player, parent, optionsopt)

Creates an instance of the Title component.

Parameters:
Name Type Attributes Description
player Player

Reference to the VisionPlayer instance.

parent Controller

Reference to the parent instance.

options Object optional

Additional options.

Parameters:
Name Type Attributes Description
apiKey symbol optional

Token for extended access to the player API.

Members

Configuration options for the Title component.

Properties
Name Type Attributes Default Description
showSecondary boolean optional true

Shows the secondary title.

Type
Object
Source
Title.js, line 20

Reference to the main player instance.

Type
Player
Source
Title.js, line 28

Holds tokens of subscriptions to player events, for later unsubscribe.

Type
Array<number>
Source
Title.js, line 34

Holds tokens of additional subscriptions.

Type
Array<number>
Source
Title.js, line 40

Secret key only known to the player instance and initialized components. Used to be able to restrict access to API methods in conjunction with secure mode.

Type
symbol
Source
Title.js, line 47

DomSmith for the title container.

Type
DomSmith
Source
Title.js, line 53

Current media title.

Type
string
Source
Title.js, line 59

Current secondary media title.

Source
Title.js, line 64

Timeout id for resize debouncing.

Type
number
Source
Title.js, line 70

Methods

private #onDataReady(mediaItem)

Called once the media data is available. Extracts title and secondary title, and sets up UI show/hide if needed.

Parameters:
Name Type Description
mediaItem Data~mediaItem

Object containing media info.

Parameters:
Name Type Attributes Description
title string | Object<string, string> optional

The primary title (may be multilingual).

titleSecondary string | Object<string, string> optional

The secondary title (multilingual).

Listens
data/ready
Source
Title.js, line 128

private #onMediaReady()

Called when the media is ready for playback. Translates and displays the title if not hidden.

Listens
media/ready
Source
Title.js, line 153

private #show()

Hides the title.

Listens
ui/show
Source
Title.js, line 169

private #hide()

Shows the title.

Listens
ui/hide
Source
Title.js, line 180

private #resize()

Called on UI resize events. Adjusts a CSS variable to place other UI elements below the title.

Listens
ui/resize
Source
Title.js, line 191

destroy()

This method removes all events, subscriptions and DOM nodes created by this component.

Source
Title.js, line 207