setInterval(() => {
setMedia(() => mediaFromPlayer(player))
}, 20)
useEffect(() => {
const updateMedia = () => {
setMedia(mediaFromPlayer(player));
};
const intervalId = setInterval(updateMedia, 100); // Adjust the interval as needed
return () => clearInterval(intervalId); // Cleanup on unmount
}, [player]);