@@ -16,11 +16,11 @@ const webrtcPeerController = {
1616 newRequestWebRTC : RequestWebRTC
1717 ) : Promise < void > => {
1818 let servers = {
19- iceServers : [
19+ iceServers : [
2020 {
2121 urls : [
22- 'stun:stun1.1 .google.com:19302' ,
23- 'stun:stun2.1 .google.com:19302 ' ,
22+ 'stun:stun.l .google.com:19302' ,
23+ 'stun:stun.l .google.com:5349 ' ,
2424 ] ,
2525 } ,
2626 ] ,
@@ -73,42 +73,63 @@ const webrtcPeerController = {
7373 let localStream = peerConnection . createDataChannel ( 'textChannel' ) ;
7474 localStream . onopen = ( ) => console . log ( 'data channel opened' ) ;
7575 localStream . onclose = ( ) => console . log ( 'data channel closed' )
76-
76+ console . log ( 'peerConnection:' , peerConnection )
77+ console . log ( 'localstream:' , localStream )
78+ console . log ( 'newRequestWebRTCcheck:' , newRequestWebRTC )
7779 appDispatch (
7880 newRequestWebRTCSet ( {
7981 ...newRequestWebRTC ,
8082 webRTCpeerConnection : peerConnection ,
8183 webRTCLocalStream : localStream ,
8284 } )
8385 ) ;
84-
86+
8587 peerConnection . onicecandidate = async (
8688 event : RTCPeerConnectionIceEvent
8789 ) : Promise < void > => {
90+ console . log ( 'event:' , event )
8891 if ( event . candidate ) {
8992 appDispatch (
90- newRequestWebRTCOfferSet (
93+ newRequestWebRTCOfferSet ( // newRequestWebRTCOfferSet mutates the newRequestWebRTC.webrtcOffer state
9194 JSON . stringify ( peerConnection . localDescription )
9295 )
9396 ) ;
9497 }
98+ console . log ( 'newRequestWebRTCCheck4:' , newRequestWebRTC )
9599 } ;
100+
96101 }
97102 } ,
98103
99104 createOffer : async ( newRequestWebRTC : RequestWebRTC ) : Promise < void > => {
100105 //grab the peer connection off the state to manipulate further
106+ console . log ( 'newRequestWebRTCCheck2:' , newRequestWebRTC )
101107 let { webRTCpeerConnection } = newRequestWebRTC ;
108+ console . log ( 'webRTCPeerConnect:' , webRTCpeerConnection )
102109 let offer = await webRTCpeerConnection ! . createOffer ( ) ;
103- await webRTCpeerConnection ! . setLocalDescription ( offer ) ;
110+ console . log ( 'offer:' , offer )
111+ await webRTCpeerConnection ! . setLocalDescription ( offer ) ; //what is this line doing that is not already done?
112+ console . log ( 'webRTCaftersetofLocalDes:' , webRTCpeerConnection )
104113 appDispatch (
105114 newRequestWebRTCSet ( {
106115 ...newRequestWebRTC ,
107116 webRTCOffer : JSON . stringify ( offer ) ,
108117 } )
109118 ) ;
119+ console . log ( 'newRequestWebRTCCheck3:' , newRequestWebRTC )
110120 } ,
111121
122+ // need to include methodology to send offer to other peer
123+
124+ // also need to send ice candidate to other peer
125+
126+ // Ability to receive offer and candidate from other peer (using websockets)
127+
128+ // peer should be able to accept offer and candidate
129+ // peer should be able to set the offer received as the remote description
130+
131+
132+
112133 // work-in-progress
113134 createAnswer : async ( newRequestWebRTC : RequestWebRTC ) : Promise < void > => {
114135 let { webRTCpeerConnection, webRTCOffer } = newRequestWebRTC ;
@@ -121,12 +142,13 @@ const webrtcPeerController = {
121142 let answer = await webRTCpeerConnection . createAnswer ( ) ;
122143 await webRTCpeerConnection . setLocalDescription ( answer ) ;
123144
124- appDispatch (
145+ appDispatch (
125146 newRequestWebRTCSet ( {
126147 ...newRequestWebRTC ,
127148 webRTCAnswer : JSON . stringify ( answer ) ,
128149 } )
129150 ) ;
151+ console . log ( 'newRequestWebRTCCheck5:' , newRequestWebRTC )
130152 } ,
131153
132154 addAnswer : async ( reqRes : ReqRes ) : Promise < void > => {
0 commit comments