import React, { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import { makeStyles } from 'tss-react/mui'; import { IReduxState } from '../../app/types'; import VideoManager from '../../shared-video/components/web/VideoManager'; import YoutubeVideoManager from '../../shared-video/components/web/YoutubeVideoManager'; import { isSharedVideoEnabled, isVideoPlaying } from '../../shared-video/functions'; import logger from '../logger'; /** * The type of the React {@code Component} props of {@link SecondScreenSharedVideo}. */ interface IProps { /** * The id of the second-screen window this view renders into. */ id: string; } /** * The styles, injected into the second window via its own Emotion cache. */ const useStyles = makeStyles()(() => { return { container: { width: '100%', height: '100%', backgroundColor: '#040404', // The follower player is view-only: a local pause here would not // be reflected in the meeting and would silently desync until the // owner's next update. pointerEvents: 'none', // react-youtube renders the player inside a plain wrapper div; // stretch it (and the player itself) to fill the window. '& > div, & iframe, & video': { width: '100%', height: '100%' } }, placeholder: { width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: '#040404' }, message: { fontSize: 16, color: 'rgba(255, 255, 255, 0.5)' } }; }); /** * Renders the video (e.g. YouTube) shared in the meeting on a second screen. * The player is the same manager the meeting window uses, mounted as a * follower: it tracks the shared playback state (play/pause/seek) but never * acts as the controlling player, and plays no audio; the audio stays with * the main window's player. Like the whiteboard, this is the kind of * non-video content a plain {@code