Skip to main content
Version: v7 Beta

Function: useEvent()

function useEvent<T>(
player,
event,
callback): void;

Defined in: hooks/useEvent.ts:12

Attaches an event listener to a VideoPlayer instance for a specified event.

Type Parameters

Type Parameter
T extends keyof VideoPlayerEvents | "onError"

Parameters

ParameterTypeDescription
playerVideoPlayerThe player to attach the event to
eventTThe name of the event to attach the callback to
callbackAllPlayerEvents[T]The callback for the event

Returns

void