File tree Expand file tree Collapse file tree 2 files changed +4
-32
lines changed
examples/mobile-client/mobile-fishjam-chat/app Expand file tree Collapse file tree 2 files changed +4
-32
lines changed Original file line number Diff line number Diff line change @@ -42,17 +42,11 @@ export default function LivestreamStreamerScreen() {
4242 const [ isInitialized , setIsInitialized ] = useState ( false ) ;
4343
4444 useEffect ( ( ) => {
45- let didInitializeDevices = false ;
46- let didStartCamera = false ;
47- let didStartMicrophone = false ;
4845 const setup = async ( ) => {
4946 try {
5047 await initializeDevices ( { enableVideo : true , enableAudio : true } ) ;
51- didInitializeDevices = true ;
5248 await startCamera ( ) ;
53- didStartCamera = true ;
5449 await startMicrophone ( ) ;
55- didStartMicrophone = true ;
5650 setIsInitialized ( true ) ;
5751 } catch ( err ) {
5852 console . error ( "Failed to initialize media devices:" , err ) ;
@@ -66,20 +60,8 @@ export default function LivestreamStreamerScreen() {
6660 } catch ( err ) {
6761 console . error ( "Failed to disconnect livestream streamer:" , err ) ;
6862 }
69- if ( didStartCamera ) {
70- try {
71- stopCamera ( ) ;
72- } catch ( err ) {
73- console . error ( "Failed to stop camera:" , err ) ;
74- }
75- }
76- if ( didStartMicrophone ) {
77- try {
78- stopMicrophone ( ) ;
79- } catch ( err ) {
80- console . error ( "Failed to stop microphone:" , err ) ;
81- }
82- }
63+ stopCamera ( ) ;
64+ stopMicrophone ( ) ;
8365 } ;
8466 //TODO: FCE-2509 Add dependencies when startCamera gets fixed
8567 // eslint-disable-next-line react-hooks/exhaustive-deps
Original file line number Diff line number Diff line change @@ -49,17 +49,11 @@ export default function PreviewScreen() {
4949 const hasJoinedRef = useRef ( false ) ;
5050
5151 useEffect ( ( ) => {
52- let didInitializeDevices = false ;
53- let didStartCamera = false ;
54- let didStartMicrophone = false ;
5552 const setup = async ( ) => {
5653 try {
5754 await initializeDevices ( { enableVideo : true , enableAudio : true } ) ;
58- didInitializeDevices = true ;
5955 await startCamera ( ) ;
60- didStartCamera = true ;
6156 await startMicrophone ( ) ;
62- didStartMicrophone = true ;
6357 setIsInitialized ( true ) ;
6458 } catch ( err ) {
6559 console . error ( "Failed to initialize devices:" , err ) ;
@@ -75,12 +69,8 @@ export default function PreviewScreen() {
7569 } catch ( err ) {
7670 console . error ( "Failed to leave room:" , err ) ;
7771 }
78- if ( didStartCamera ) {
79- stopCamera ( ) ;
80- }
81- if ( didStartMicrophone ) {
82- stopMicrophone ( ) ;
83- }
72+ stopCamera ( ) ;
73+ stopMicrophone ( ) ;
8474 }
8575 } ;
8676 // eslint-disable-next-line react-hooks/exhaustive-deps
You can’t perform that action at this time.
0 commit comments