From b6ba509db47c3976a257e53aa516ec994291810e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor?= Date: Mon, 25 Mar 2024 12:19:25 -0300 Subject: [PATCH] fix: unpin notes when sharing external video --- .../component.tsx | 18 ++++++++++++++++++ .../imports/ui/components/pads/service.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx b/bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx index 031492c267..72b99e24c6 100644 --- a/bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx +++ b/bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx @@ -13,6 +13,8 @@ import * as PluginSdk from 'bigbluebutton-html-plugin-sdk'; import { UI_DATA_LISTENER_SUBSCRIBED } from 'bigbluebutton-html-plugin-sdk/dist/cjs/ui-data-hooks/consts'; import { ExternalVideoVolumeUiDataNames } from 'bigbluebutton-html-plugin-sdk'; import { ExternalVideoVolumeUiDataPayloads } from 'bigbluebutton-html-plugin-sdk/dist/cjs/ui-data-hooks/external-video/volume/types'; +import MediaService from '/imports/ui/components/media/service'; +import NotesService from '/imports/ui/components/notes/service'; import useMeeting from '/imports/ui/core/hooks/useMeeting'; import { @@ -74,6 +76,8 @@ interface ExternalVideoPlayerProps { layoutContextDispatch: ReturnType; key: string; setKey: (key: string) => void; + shouldShowSharedNotes(): boolean; + pinSharedNotes(pinned: boolean): void; } // @ts-ignore - PeerTubePlayer is not typed @@ -96,6 +100,8 @@ const ExternalVideoPlayer: React.FC = ({ layoutContextDispatch, key, setKey, + shouldShowSharedNotes, + pinSharedNotes, }) => { const intl = useIntl(); @@ -250,6 +256,16 @@ const ExternalVideoPlayer: React.FC = ({ } }, [playerRef.current]); + useEffect(() => { + if (shouldShowSharedNotes()) { + pinSharedNotes(false); + return () => { + pinSharedNotes(true); + }; + } + return undefined; + }, []); + // --- Plugin related code ---; const internalPlayer = playerRef.current?.getInternalPlayer ? playerRef.current?.getInternalPlayer() : null; if (internalPlayer && internalPlayer?.isMuted @@ -526,6 +542,8 @@ const ExternalVideoPlayerContainer: React.FC = () => { currentTime={isPresenter ? playerCurrentTime : currentTime} key={key} setKey={setKey} + shouldShowSharedNotes={MediaService.shouldShowSharedNotes} + pinSharedNotes={NotesService.pinSharedNotes} /> ); }; diff --git a/bigbluebutton-html5/imports/ui/components/pads/service.js b/bigbluebutton-html5/imports/ui/components/pads/service.js index 236b898f98..c20d13657d 100644 --- a/bigbluebutton-html5/imports/ui/components/pads/service.js +++ b/bigbluebutton-html5/imports/ui/components/pads/service.js @@ -113,7 +113,7 @@ const getPinnedPad = () => { const pinPad = (externalId, pinned, stopWatching) => { if (pinned) { // Stop external video sharing if it's running. - stopWatching(); + if (typeof stopWatching === 'function') stopWatching(); // Stop screen sharing if it's running. if (isScreenBroadcasting()) screenshareHasEnded();