- Version
- 1.0.0
- License
- MIT
- Requires
- DomSmith
- AsyncTask
- ExtendedMediaError
- object
- scriptLoader
- Source
- Vimeo.js, line 21
Constructor
new Vimeo(player, parent, options)
Creates an instance of the Vimeo engine.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
player |
Player |
Reference to the player instance. |
||||||
parent |
Object |
Reference to the parent component (unused for engines). |
||||||
options |
Object |
Additional options.
|
Members
private #config :Object
Holds the instance configuration for this component.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
lazyLoadLib
|
boolean | optional | true | If |
doNotTrack
|
boolean | optional | true | If |
private #player :Player
private #apiKey :symbol
Secret key only known to the player instance and initialized components. Used to restrict access to API methods in secure mode.
private #metaData :Media~metaData
Holds metadata information provided by media.load.
- Type
- Media~metaData
- Source
- Vimeo.js, line 51
private #vimeoPlayer :Object
private #loadTask :AsyncTask
Reference to the Async Task instance. Used to handle async tasks, which can be cancelled, resolved or rejected.
private #scriptLoadPromise :Promise|null
Cancelable promise for script loading. Used to prevent callbacks when destroyed.
private #subscriptions :Array<number>
Holds tokens of subscriptions to player events, for later unsubscribe.
private #state :Object
private #container :DomSmith
private #subtitleRenderer :Object|null
Subtitle renderer instance used to mirror cue changes into the player UI.
private #pipActive :boolean
private #pendingVimeoMethod :'requestPictureInPicture'|null
Remembers the last invoked Vimeo API method to disambiguate error handling.
private #qualities :Array<(null|number|string)>
List of available qualities (could be numeric or textual, but can also be "null" which means "auto").
private, static #emptyRange :Object
private, static #defaultState :Object
Methods
canPlay(metaData) → 'probably'|''
Checks if this engine can play the given media data, by checking if the source contains a valid Vimeo video ID.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
metaData |
Media~metaData |
The data to test.
|
private #loadLib() → Promise<Object>
Loads Vimeo Player API via CDN if not present. Uses the centralized scriptLoader utility for deduplication and reliability.
private #load(metaData, optionsopt) → Promise<Media~metaData>
Loads media into the Vimeo player.
| Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metaData |
Media~metaData |
The media data to load. |
||||||||||||||||||||||||||||||||||||
options |
Object | optional |
Additional options.
|
- Returns
-
Resolves with current metadata once API is available.
- Type Promise<Media~metaData>
- Source
- Vimeo.js, line 229
private #onLoaded() → Promise<void>
Syncs metadata after load and emits Media API events.
- Fires
- quality/update
- quality/active
- language/update
- language/active
- media/loadedmetadata
- media/ready
- media/loadeddata
- media/canplay
- media/canplaythrough
- media/progress
- Returns
-
Resolves when metadata propagation is complete.
- Type Promise<void>
- Source
- Vimeo.js, line 337
private #getMetaData() → Media~metaData
Returns the current metadata.
- Returns
-
The current metadata.
- Type Media~metaData
- Source
- Vimeo.js, line 461
private #play()
Plays the media.
- Fires
- media/play
- Source
- Vimeo.js, line 467
private #pause()
Pauses the media.
- Fires
- media/pause
- Source
- Vimeo.js, line 479
private #loop(loop)
Sets the loop state.
| Name | Type | Description |
|---|---|---|
loop |
boolean |
Whether to loop. |
- Fires
- media/loop
- Source
- Vimeo.js, line 492
private #playbackRate(rate)
Sets the playback rate.
| Name | Type | Description |
|---|---|---|
rate |
number |
The playback rate (0.5 to 2). |
- Fires
- media/ratechange
- Source
- Vimeo.js, line 506
private #seek(time)
Seeks to a specific time.
| Name | Type | Description |
|---|---|---|
time |
number |
The time to seek to (in seconds). |
private #volume(volume)
Sets the volume.
| Name | Type | Description |
|---|---|---|
volume |
number |
The volume (0 to 1). |
- Fires
- media/volumechange
- Source
- Vimeo.js, line 549
private #mute(mute)
Sets the mute state.
| Name | Type | Description |
|---|---|---|
mute |
boolean |
Whether to mute. |
- Fires
- media/volumechange
- Source
- Vimeo.js, line 565
private #requestPictureInPicture()
Requests Picture-in-Picture mode via Vimeo API.
- Fires
- media/enterpictureinpicture
- Source
- Vimeo.js, line 583
private #exitPictureInPicture()
Exits Picture-in-Picture mode via Vimeo API.
- Fires
- media/leavepictureinpicture
- Source
- Vimeo.js, line 596
private #onPlay()
Handles Vimeo "play" to keep internal state aligned and propagate the Media API event.
- Fires
- media/play
- Source
- Vimeo.js, line 608
private #onPlaying()
Handles Vimeo "playing" to mirror the active playback state.
- Fires
- media/playing
- Source
- Vimeo.js, line 620
private #onPause()
Handles Vimeo "pause" and forwards the Media API event.
- Fires
- media/pause
- Source
- Vimeo.js, line 631
private #onEnded()
Handles Vimeo "ended", optionally restarts on loop, and fires Media API events.
- Fires
- media/ended
- Source
- Vimeo.js, line 642
private #onTimeUpdate(data)
Handles Vimeo "timeupdate" payloads and recomputes derived timing state.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object |
Event data from Vimeo.
|
- Fires
- media/timeupdate
- Source
- Vimeo.js, line 662
private #onProgress(data)
Handles Vimeo "progress" events and updates buffered range.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object |
Event data from Vimeo.
|
- Fires
- media/progress
- Source
- Vimeo.js, line 682
private #onSeeked()
Handles Vimeo "seeked" and forwards Media API event.
- Fires
- media/seeked
- Source
- Vimeo.js, line 701
private #onBufferStart()
Handles Vimeo "bufferstart".
- Fires
- media/waiting
- Source
- Vimeo.js, line 707
private #onBufferEnd()
Handles Vimeo "bufferend".
- Fires
- media/canplay
- Source
- Vimeo.js, line 713
private #onCueChange(event)
Handles Vimeo cue changes and feeds them into the subtitle renderer.
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
event |
Object |
Vimeo cue event.
|
private #onRateChange(data)
Handles Vimeo playback-rate changes.
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
data |
Object |
Event data from Vimeo.
|
- Fires
- media/ratechange
- Source
- Vimeo.js, line 728
private #onVolumeChange(data)
Handles Vimeo volume changes.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object |
Event data from Vimeo.
|
- Fires
- media/volumechange
- Source
- Vimeo.js, line 743
private #onPipEnter()
Handles Vimeo enter-PiP.
- Fires
- media/enterpictureinpicture
- Source
- Vimeo.js, line 756
private #onPipExit()
Handles Vimeo leave-PiP.
- Fires
- media/leavepictureinpicture
- Source
- Vimeo.js, line 768
private #onSubtitlesSelected(payloadopt)
Reacts to player subtitle selection updates.
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
payload |
Object | optional |
Selection payload.
|
private #onQualitySelected(payload)
Applies a quality selection coming from the player UI.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
payload |
Object |
Payload emitted by the quality menu.
|
- Fires
- quality/active
- Listens
- quality/selected
- Source
- Vimeo.js, line 822
private #onQualityResize(size)
Handler for 'quality/resize' event. Caps the max bitrate if display size is small.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
size |
Object |
Object containing size information.
|
- Listens
- quality/resize
- Source
- Vimeo.js, line 842
private #getBestQuality(height) → number|null
Picks the best quality for a given height.
| Name | Type | Description |
|---|---|---|
height |
number |
The height in pixels. |
private #onLanguageSelected(langObj)
Applies an audio language selection coming from the player UI.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
langObj |
Object |
Payload emitted by the language menu.
|
- Fires
- language/active
- Listens
- language/selected
- Source
- Vimeo.js, line 875
private #onError(error)
Normalizes Vimeo errors into ExtendedMediaError and forwards notifications where appropriate.
| Name | Type | Description |
|---|---|---|
error |
Object |
Vimeo error object. |
- Fires
- media/error
- notification
- Source
- Vimeo.js, line 892
private #getIFrameElement() → HTMLElement|null
Returns the Vimeo iframe element (falls back to the wrapper if not mounted yet).
async enable()
Enables the Vimeo engine by loading the API, mounting the iframe container and exposing state accessors.
disable()
destroy()
This method removes all events, subscriptions and DOM nodes created by this component.
private, static #toRange(start, end) → Object
Converts start and end times to a TimeRanges-like object.
| Name | Type | Description |
|---|---|---|
start |
number |
Start time. |
end |
number |
End time. |