1- import React , { useState , useEffect , useRef } from 'react' ;
1+ import React , { useState } from 'react' ;
22import { MdRefresh } from 'react-icons/md' ;
33
44// import '/Users/katharinehunt/Swell/src/assets/style/WebRtcEntry.css';
@@ -43,6 +43,10 @@ const WebRTCServerEntryForm: React.FC<Props> = () => {
4343 // toggles state os is toggled
4444 const newToggleState = ! isToggled ;
4545 setIsToggled ( newToggleState ) ;
46+ console . log (
47+ 'Dispatching newRequestWebRTCSet with enableAudio:' ,
48+ newToggleState
49+ ) ;
4650
4751 dispatch (
4852 //sends action to redux store
@@ -53,22 +57,11 @@ const WebRTCServerEntryForm: React.FC<Props> = () => {
5357 enableAudio : newToggleState , //updates Enableaudio property in newRequestWebRTC to match toggle state
5458 } ) //enable audio updated every time toggle state changes
5559 ) ;
60+ console . log (
61+ 'enableAudio Redux state just after dispatch:' ,
62+ newRequestWebRTC . enableAudio
63+ ) ;
5664 } ;
57- //for testing audio only playback when other flaws are ruled out
58- const audioRef = useRef < HTMLAudioElement | null > ( null ) ;
59- // creates reference html audio element
60- // where useRef persists values across renders without causing rerenders //initally set to null
61- // useEffect(() => {
62- // // play audio when conditions are met
63- // if (newRequestWebRTC.webRTCLocalStream && audioRef.current) {
64- // // if local stream and current audio arent null
65- // console.log('Local Mic Playing...');
66- // audioRef.current.srcObject = newRequestWebRTC.webRTCLocalStream; // sets source of media to local stream
67- // audioRef.current
68- // .play()
69- // .catch((e) => console.warn('Electron Autoplay Issue', e)); // attempts to play it
70- // } // if error indicates it may be an issues with electron audioplayback vs video with audio
71- // }, [newRequestWebRTCSet.webRTCLocalStream]); // use effect runs whenever local stream changes
7265
7366 return (
7467 < div className = "mt-3" >
0 commit comments