Events
Frequently Used Events
Native Events
These events are proxied directly from the HTMLVideoElement
, so you can use them as you would normally do. For more information about them, please refer to the MDN documentation.
play
- Type:
event: Event
Fired as a result of the play()
method.
pause
- Type:
event: Event
Fired when a request to pause playback is handled and the video has entered its paused state, most commonly after the media
has been paused through a call to the element's pause()
method.
timeupdate
- Type:
event: Event
Fired when the time indicated by the currentTime()
value has been updated.
ended
- Type:
event: Event
Fired when playback or streaming has stopped because the end of the media was reached or because no further data is available.
playing
- Type:
event: Event
Fired after playback is first started, and whenever it is restarted. For example it is fired when playback resumes after having been paused or delayed due to lack of data.
seeking
- Type:
event: Event
Fired when a seek operation starts, meaning the media is seeking a new position.
seeked
- Type:
event: Event
Fired when a seek operation completed and current playback position has changed.
volumechange
- Type:
event: Event
Fired when either the volume()
value or the muted()
value has changed.
ratechange
- Type:
event: Event
Fired when the playback speed rate has changed.
Generic Events
play:manual
- Type:
void
Fired when the play()
method is called directly from user interaction.
mute
- Type:
void
Fired when the player is muted.
unmute
- Type:
void
Fired when the player is unmuted.
enterfullscreen
- Type:
void
Fired when the player enters fullscreen mode.
exitfullscreen
- Type:
void
Fired when the player exits fullscreen mode.
fullscreenchange
- Type:
void
Fired after the player switches into or out of fullscreen mode.
resize
- Type:
void
Fired when the player dimensions change.
error
- Type:
error: Error
This event is fired for all player errors (even when the error is not fatal and does not lead to playback interruption).
If you want to handle fatal errors only, use the error:fatal
event instead.
Fired when an error occurs.
interface Error {
type: 'hls' | 'media' | 'license';
data: any;
}
error:fatal
- Type:
error: Error
Fired when a fatal error occurs without of any recovery strategy available.
destroy
- Type:
void
Fired when the player is destroyed.
Vidalytics Events
These events are specific to Vidalytics Player.
cta:show
- Type:
callToAction: CallToAction
Fired when the Call To Action is shown.
interface CallToAction {
guid: string;
displayMode: 'reserveSpace' | 'expandContainer' | 'onTop' | 'customHTML';
title: string;
link?: { href: string; blank: boolean };
type: 'exit' | 'time';
time?: { from: number; to?: number };
color?: CallToActionColor;
colorHover?: CallToActionColor;
shadow?: boolean;
showToReturningViewers?: boolean;
showOnlyWhenTriggeredBefore?: boolean;
htmlSelectorType?: 'id' | 'class';
htmlSelector?: string;
}
interface CallToActionColor {
foreground?: string;
background?: string;
force?: boolean;
}
cta:click
- Type:
callToAction: CallToAction
Fired when the Call To Action button is clicked.
cta:hide
- Type:
callToAction: CallToAction
Fired when the Call To Action is hidden.
playgate:show
- Type:
playGateId: string
Fired when the Play Gate is shown.
playgate:submit
- Type:
playGateId: string, formValues: FormValues
Fired when the Play Gate form is submitted.
interface FormValues {
[key: string]: string;
}
playgate:skip
- Type:
playGateId: string
Fired when the Play Gate is skipped.