Merge pull request #19896 from JoVictorNunes/issue-19800

fix: unpin notes when sharing external video
This commit is contained in:
Ramón Souza 2024-03-26 09:24:41 -03:00 committed by GitHub
commit df278dfd30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,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 {
@ -72,6 +74,8 @@ interface ExternalVideoPlayerProps {
currentTime: number;
key: string;
setKey: (key: string) => void;
shouldShowSharedNotes(): boolean;
pinSharedNotes(pinned: boolean): void;
}
// @ts-ignore - PeerTubePlayer is not typed
@ -93,6 +97,8 @@ const ExternalVideoPlayer: React.FC<ExternalVideoPlayerProps> = ({
isEchoTest,
key,
setKey,
shouldShowSharedNotes,
pinSharedNotes,
}) => {
const intl = useIntl();
@ -237,6 +243,16 @@ const ExternalVideoPlayer: React.FC<ExternalVideoPlayerProps> = ({
}
}, [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
@ -511,6 +527,8 @@ const ExternalVideoPlayerContainer: React.FC = () => {
currentTime={isPresenter ? playerCurrentTime : currentTime}
key={key}
setKey={setKey}
shouldShowSharedNotes={MediaService.shouldShowSharedNotes}
pinSharedNotes={NotesService.pinSharedNotes}
/>
);
};

View File

@ -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();