unknown преди 2 години
родител
ревизия
bfe7456a58

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
.eslintcache


+ 5 - 5
build/asset-manifest.json

@@ -4,13 +4,13 @@
     "static/js/0.80d38630.chunk.js.map": "/static/js/0.80d38630.chunk.js.map",
     "AuthPage.js": "/static/js/AuthPage.8bf438db.chunk.js",
     "AuthPage.js.map": "/static/js/AuthPage.8bf438db.chunk.js.map",
-    "HomePage.js": "/static/js/HomePage.00c8d7e3.chunk.js",
-    "HomePage.js.map": "/static/js/HomePage.00c8d7e3.chunk.js.map",
+    "HomePage.js": "/static/js/HomePage.7c0e03b5.chunk.js",
+    "HomePage.js.map": "/static/js/HomePage.7c0e03b5.chunk.js.map",
     "main.css": "/static/css/main.648af75f.chunk.css",
     "main.js": "/static/js/main.f1c56119.chunk.js",
     "main.js.map": "/static/js/main.f1c56119.chunk.js.map",
-    "runtime-main.js": "/static/js/runtime-main.304a5904.js",
-    "runtime-main.js.map": "/static/js/runtime-main.304a5904.js.map",
+    "runtime-main.js": "/static/js/runtime-main.75029880.js",
+    "runtime-main.js.map": "/static/js/runtime-main.75029880.js.map",
     "static/js/5.f4279fe9.chunk.js": "/static/js/5.f4279fe9.chunk.js",
     "static/js/5.f4279fe9.chunk.js.map": "/static/js/5.f4279fe9.chunk.js.map",
     "static/css/6.c7cc29b3.chunk.css": "/static/css/6.c7cc29b3.chunk.css",
@@ -29,7 +29,7 @@
     "static/media/wallpaperNight.63a4f24a.jpg": "/static/media/wallpaperNight.63a4f24a.jpg"
   },
   "entrypoints": [
-    "static/js/runtime-main.304a5904.js",
+    "static/js/runtime-main.75029880.js",
     "static/css/6.c7cc29b3.chunk.css",
     "static/js/6.7a556023.chunk.js",
     "static/css/main.648af75f.chunk.css",

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
build/index.html


Файловите разлики са ограничени, защото са твърде много
+ 0 - 1
build/static/js/HomePage.00c8d7e3.chunk.js.map


Файловите разлики са ограничени, защото са твърде много
+ 2 - 2
build/static/js/HomePage.00c8d7e3.chunk.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 0
build/static/js/HomePage.7c0e03b5.chunk.js.map


Файловите разлики са ограничени, защото са твърде много
+ 2 - 2
build/static/js/runtime-main.304a5904.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
build/static/js/runtime-main.304a5904.js.map


+ 16 - 19
src/components/HomePage/CallBar/index.tsx

@@ -163,6 +163,7 @@ const CallBar = ({callStatus,setCallStatus,socket,myVideoRef}:ICallBar) => {
   const connectionRef = useRef<any>(null);
   const [mySocket, setMySocket] = useState<string>('')
   const [companionSocket, setCompanionSocket] = useState<string>('')
+  const [companionSignal, setCompanionSignal] = useState<string>('')
   const [name, setName] = useState<string>('')
   const [lastName, setLastName] = useState<string>('')
   const [avatarUrl, setAvatarUrl] = useState<string>('')
@@ -194,14 +195,14 @@ const CallBar = ({callStatus,setCallStatus,socket,myVideoRef}:ICallBar) => {
       })
       setCallStatus('ringing')
     });
-    // peer.on("stream", (stream: any) => {
-    //   console.log(stream,'user stream')
-    // });
-    // socket.on("acceptedCall", ({ signal }: any) => {
-    //   // peer.signal(signal)
-    //   setCallStatus('accepted')
-    //   console.log(signal,'signal accepted from companion')
-    // });
+    peer.on("stream", (stream: any) => {
+      console.log(stream,'user stream')
+    });
+    socket.on("acceptedCall", ({ signal }: any) => {
+      peer.signal(signal)
+      setCallStatus('accepted')
+      console.log(signal,'signal accepted from companion')
+    });
     connectionRef.current = peer; 
   },[chat.socketId,chat.companionId,_id,socket,setCallStatus,mySocket])
 
@@ -217,14 +218,13 @@ const CallBar = ({callStatus,setCallStatus,socket,myVideoRef}:ICallBar) => {
     });
     peer.on("signal", (data: any) => {
       socket.emit("answerCall", { signal: data, to: companionSocket });
-      console.log(data,'sent the signal on answer')
     });
-    // peer.on("stream", (stream: any) => {
-    //   console.log(stream,'user stream')
-    // });
-    // peer.signal();
+    peer.on("stream", (stream: any) => {
+      userVideoRef.current.srcObject = stream;
+    });
+    peer.signal(companionSignal);
     connectionRef.current = peer;
-  },[socket,companionSocket])
+  },[socket,companionSocket,companionSignal])
 
   useEffect(() => {
     socket.on("me", (id: string) => {
@@ -239,12 +239,9 @@ const CallBar = ({callStatus,setCallStatus,socket,myVideoRef}:ICallBar) => {
       setColor(data.color)
       setNumber(data.number)
       setCompanionSocket(data.from)
-      console.log(data,'incomeCall')
-    })
-    socket.on('acceptedCall', (data: any) => {
-      console.log(data,'acceptedCall')
+      setCompanionSignal(data.signal)
     })
-  },[socket,setCallStatus,setName,setLastName,setCompanionSocket])
+  },[socket,setCallStatus,setName,setLastName,setCompanionSocket,setCompanionSignal])
 
   useEffect(() => {
     if(callStatus === 'requesting') handleStartCall()