UNPKG

@saran-ign/video-annotation-tool

Version:

[![npm version](https://img.shields.io/npm/v/@saran-ign/video-annotation-tool.svg)](https://www.npmjs.com/package/@saran-ign/video-annotation-tool) [![npm downloads](https://img.shields.io/npm/dm/@saran-ign/video-annotation-tool.svg)](https://www.npmjs.co

23 lines (22 loc) 616 B
// @ts-nocheck import { useRef } from 'react'; export default function usePlayer() { const playerRef = useRef(null); /* * Get the current time of the video * @returns {number} time in milliseconds */ const getCurrentTime = () => { var _a; if (playerRef.current) { const currentTimeInMs = Math.floor(((_a = playerRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) * 1000); console.log(currentTimeInMs); return currentTimeInMs; } return 0; }; return { playerRef, getCurrentTime }; }