Files
2026-03-25 17:28:35 +01:00

19 lines
578 B
JavaScript

"use strict";
import { useEffect } from 'react';
/**
* Attaches an event listener to a `VideoPlayer` instance for a specified event.
*
* @param player - The player to attach the event to
* @param event - The name of the event to attach the callback to
* @param callback - The callback for the event
*/
export const useEvent = (player, event, callback) => {
useEffect(() => {
const subscription = player.addEventListener(event, callback);
return () => {
subscription.remove();
};
}, [player, event, callback]);
};
//# sourceMappingURL=useEvent.js.map