I have tried using some npm embed libraries that support video players however any onPlay, on Pause or onDuration don’t give me current time of stream, when the video pauses, it goes back to 0 and the video time always starts at 0 even when the stream has been runing, and it’s just never accurate. (it works with youtube non live video tho)
Iframe by it’self doesn’t seem to have any feature like this either:
// Source - https://stackoverflow.com/q/79050494
// Posted by Eliška Pavlů, modified by community. See post 'Timeline' for change history
// Retrieved 2026-08-24, License - CC BY-SA 4.0
export const GameData = () => {
const [videoTime, setVideoTime] = useState(0);
const [data, setData] = useState<JsonData | null>(null);
const playerRef = useRef(null);
useEffect(() => {
if (jsonData) {
setData(jsonData as JsonData);
}
console.log(jsonData);
},
);
useEffect(() => {
console.log("Current time:", videoTime);
}, [videoTime]);
const handleProgress = (state: {playedSeconds: number}) => {
setVideoTime(state.playedSeconds);
};
const handlePause = () => {
if (playerRef.current) {
const currentTime = playerRef.current.getCurrentTime();
setVideoTime(currentTime);
}
};
const handlePlay = () => {
if (playerRef.current) {
const currentTime = playerRef.current.getCurrentTime();
setVideoTime(currentTime);
}
};
const handleReady = () => {
if (playerRef.current) {
playerRef.current.seekTo(0);
}
};
return (
{data?.Events.length ?? "s"}
<ReactPlayer
ref={playerRef}
controls={true}
url="
"
onDuration={duration => console.log("Duration:", duration)}
/>
);
};
Already asked here: https://stackoverflow.com/questions/79050494/is-there-any-way-to-get-time-where-the-twitch-stream-is-at-in-embedd But still not getting any response.