diff --git a/packages/core/src/components/mediaToggle.ts b/packages/core/src/components/mediaToggle.ts index 67b27fd56..6cb770916 100644 --- a/packages/core/src/components/mediaToggle.ts +++ b/packages/core/src/components/mediaToggle.ts @@ -91,11 +91,13 @@ export function setupMediaToggle( ); return localParticipant.isMicrophoneEnabled; case Track.Source.ScreenShare: - await localParticipant.setScreenShareEnabled( - forceState ?? !localParticipant.isScreenShareEnabled, - captureOptions as ScreenShareCaptureOptions, - publishOptions, - ); + // await localParticipant.setScreenShareEnabled( + // forceState ?? !localParticipant.isScreenShareEnabled, + // captureOptions as ScreenShareCaptureOptions, + // publishOptions, + // ); + console.warn('do nothing, use custom screen share picker.'); + return localParticipant.isScreenShareEnabled; default: throw new TypeError('Tried to toggle unsupported source'); diff --git a/packages/react/src/components/controls/TrackToggle.tsx b/packages/react/src/components/controls/TrackToggle.tsx index 079e19b7b..14c28dd7d 100644 --- a/packages/react/src/components/controls/TrackToggle.tsx +++ b/packages/react/src/components/controls/TrackToggle.tsx @@ -18,6 +18,7 @@ export interface TrackToggleProps captureOptions?: CaptureOptionsBySource; publishOptions?: TrackPublishOptions; onDeviceError?: (error: Error) => void; + onClick?: (evt: React.MouseEvent) => void; } /** diff --git a/packages/react/src/prefabs/ControlBar.tsx b/packages/react/src/prefabs/ControlBar.tsx index 8cc21f11b..635415dad 100644 --- a/packages/react/src/prefabs/ControlBar.tsx +++ b/packages/react/src/prefabs/ControlBar.tsx @@ -35,6 +35,7 @@ export interface ControlBarProps extends React.HTMLAttributes { * @alpha */ saveUserChoices?: boolean; + onScreenShareClick?: (evt: React.MouseEvent) => void; } /** @@ -58,6 +59,7 @@ export function ControlBar({ controls, saveUserChoices = true, onDeviceError, + onScreenShareClick, ...props }: ControlBarProps) { const [isChatOpen, setIsChatOpen] = React.useState(false); @@ -93,7 +95,8 @@ export function ControlBar({ [variation], ); const showText = React.useMemo( - () => variation === 'textOnly' || variation === 'verbose', + // () => variation === 'textOnly' || variation === 'verbose', + () => false, [variation], ); @@ -173,6 +176,7 @@ export function ControlBar({ captureOptions={{ audio: true, selfBrowserSurface: 'include' }} showIcon={showIcon} onChange={onScreenShareChange} + onClick={onScreenShareClick} onDeviceError={(error) => onDeviceError?.({ source: Track.Source.ScreenShare, error })} > {showText && (isScreenShareEnabled ? 'Stop screen share' : 'Share screen')} diff --git a/packages/react/src/prefabs/VideoConference.tsx b/packages/react/src/prefabs/VideoConference.tsx index 62af5d61f..7480b5ef1 100644 --- a/packages/react/src/prefabs/VideoConference.tsx +++ b/packages/react/src/prefabs/VideoConference.tsx @@ -29,6 +29,7 @@ import { useWarnAboutMissingStyles } from '../hooks/useWarnAboutMissingStyles'; */ export interface VideoConferenceProps extends React.HTMLAttributes { chatMessageFormatter?: MessageFormatter; + onScreenShareClick?: (evt: React.MouseEvent) => void; chatMessageEncoder?: MessageEncoder; chatMessageDecoder?: MessageDecoder; /** @alpha */ @@ -58,6 +59,7 @@ export function VideoConference({ chatMessageDecoder, chatMessageEncoder, SettingsComponent, + onScreenShareClick, ...props }: VideoConferenceProps) { const [widgetState, setWidgetState] = React.useState({ @@ -155,7 +157,7 @@ export function VideoConference({ )} - +