Search.../

onPlay( )

Adds an event handler that runs when the playback is started or restarted.

Description

A video in a video box is played when a site visitor clicks the video box's play button or by calling its play() function.

Syntax

function onPlay(handler: EventHandler): VideoBox
handler: function EventHandler(event: Event): void

onPlay Parameters

NAME
TYPE
DESCRIPTION
handler

The name of the function or the function expression to run when the video in the video box is played.

Returns

The video box that triggered the event.

Return Type:

EventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The event that occurred.

Returns

This function does not return anything.

Return Type:

void

Related Content:

Was this helpful?

Get the ID of the video box that is playing

Copy Code
1$w("#myVideoBox").onPlay( (event) => {
2 let targetId = event.target.id; // "myVideoBox"
3});