From 79f731769231522246fcf6039c83a204673a1922 Mon Sep 17 00:00:00 2001 From: sasumaki Date: Tue, 18 Aug 2026 17:04:25 +0300 Subject: [PATCH 1/2] Add track pausing --- .../react-native/WhipWhepDemo/app/whip.tsx | 29 +++++++++++++++++++ .../java/com/mobilewhep/client/ClientBase.kt | 18 ++++++++++++ .../java/com/mobilewhep/client/WhipClient.kt | 4 +++ .../Sources/ios-client/ClientBase.swift | 18 ++++++++++++ .../Sources/ios-client/WhipClient.swift | 3 ++ .../ReactNativeMobileWhipClientView.kt | 14 +++++++++ .../ReactNativeMobileWhipClientViewModule.kt | 8 +++++ .../ios/ReactNativeMobileWhipClientView.swift | 20 +++++++++++++ ...eactNativeMobileWhipClientViewModule.swift | 8 +++++ .../src/ReactNativeMobileWhepClient.types.ts | 2 ++ .../src/ReactNativeMobileWhipClientView.tsx | 6 ++++ 11 files changed, 130 insertions(+) diff --git a/examples/react-native/WhipWhepDemo/app/whip.tsx b/examples/react-native/WhipWhepDemo/app/whip.tsx index 008887e6..4ca51537 100644 --- a/examples/react-native/WhipWhepDemo/app/whip.tsx +++ b/examples/react-native/WhipWhepDemo/app/whip.tsx @@ -26,6 +26,8 @@ export default function WhipScreen() { const [isLoading, setIsLoading] = useState(false); const [shouldShowStreamBtn, setShouldShowStreamBtn] = useState(true); const [streamMode, setStreamMode] = useState('selection'); + const [audioEnabled, setAudioEnabled] = useState(true); + const [videoEnabled, setVideoEnabled] = useState(true); const whipClient = useRef(null); @@ -149,6 +151,24 @@ export default function WhipScreen() { } }, []); + const handleToggleAudio = useCallback(async () => { + try { + await whipClient.current?.setAudioEnabled(!audioEnabled); + setAudioEnabled(!audioEnabled); + } catch (error) { + console.error('Failed to toggle audio:', error); + } + }, [audioEnabled]); + + const handleToggleVideo = useCallback(async () => { + try { + await whipClient.current?.setVideoEnabled(!videoEnabled); + setVideoEnabled(!videoEnabled); + } catch (error) { + console.error('Failed to toggle video:', error); + } + }, [videoEnabled]); + const handleSetH264VideoCodec = useCallback(async () => { if (whipClient.current) { try { @@ -240,6 +260,15 @@ export default function WhipScreen() { )} +