сделай чтобы засчитывались события созданные человеком, если я из сервера пришлю на перемотку сработает событие на перемотку и т.д.:  const handleMessage = useCallback((event) => {

        const data = event.data;
        if (data && data.type) {

            let timestamp = Date.now() / 1000;
            switch (data.type) {
                case 'play':
                    remoteControlplay.current = true;
                    socket.emit('videoControl', { roomId, action: "play", data: data.time, timestamp: timestamp });
                    break;
                case 'pause':
                    remoteControlpause.current = true;
                    socket.emit('videoControl', { roomId, action: "pause", data: data.time, timestamp: timestamp });
                    break;
                case 'seeking':
                    remoteControlseek.current = true;
                    timestamp = Date.now() / 1000;
                    socket.emit('videoControl', { roomId, action: "seek", data: data.time, timestamp: timestamp });

                    break;
                case 'sync':

                    timestamp = Date.now() / 1000;
                    socket.emit('videoControl', { roomId,action: "sync", data: data.time, timestamp: timestamp });

                    break;
                case 'playlistItem':
                    remoteControlchange.current = true;
                    currentSeasonRef.current = data.season;
                    currentEpisodeRef.current = data.episode;
                    socket.emit('videoControl', {
                        roomId,
                        action: "changeEpisode",
                        data: { season: data.season, episode: data.episode }
                    });
                    break;
                default:
                    break;
            }
        }
    }, [roomId]);

    // Добавление и удаление слушателя сообщений из iframe
    useEffect(() => {
        window.addEventListener('message', handleMessage);
        return () => {
            window.removeEventListener('message', handleMessage);
        };
    }, [handleMessage]);

    // Обработчик событий сокета, обернутый в useCallback
    const handleVideoControl = useCallback((data) => {
        if (iframeRef.current) {
            let message = {};
            let timestamp = Date.now() / 1000;
            switch (data.action) {
                case "setUrl":

                    setVideoUrl(data.data);
                    break;
                case "play":
                    if (remoteControlplay.current) {
                        remoteControlplay.current = false;
                        break;
                    }
                    message.action = data.action;
                    break;
                case "pause":
                    if (remoteControlpause.current) {
                        remoteControlpause.current = false;
                        break;
                    }
                    message.action = data.action;
                    break;
                case "seek":
                    if (remoteControlseek.current) {
                        remoteControlseek.current = false;
                        break;
                    }
                    message.action = 'seek';

                    message.time = data.data + (timestamp-data.timestamp);

                    break;
                case "sync":

                    timestamp = Date.now() / 1000;
                    message.action = 'seek';
                    message.time = data.data + (timestamp-data.timestamp) + 0.05;


                    break;
                case "changeEpisode":
                    if (remoteControlchange.current) {
                        remoteControlchange.current = false;
                        break;
                    }
                    if (
                        currentSeasonRef.current.toString() !== data.data.season.toString() ||
                        currentEpisodeRef.current.toString() !== data.data.episode.toString()
                    ) {
                        message.action = 'changeEpisode';
                        message.season = data.data.season;
                        message.episode = data.data.episode;
                    }
                    break;
                default:
                    break;
            }
            if (data.action === "play" || data.action === "pause") {

                timestamp = Date.now() / 1000;
                iframeRef.current.contentWindow.postMessage({action: "seek",time: data.data + (timestamp - data.timestamp)}, '*');
            }

            if (Object.keys(message).length > 0) {
                console.log(message);
                iframeRef.current.contentWindow.postMessage(message, '*');
            }
        }
    }, [setVideoUrl]);