adding muting although can't catch it so to speak right now
This commit is contained in:
@@ -143,7 +143,7 @@ io.on("connection", function (socket: any) {
|
|||||||
const sendingBackData: ReceiveSignal = {
|
const sendingBackData: ReceiveSignal = {
|
||||||
simplePeerSignal: payload.simplePeerSignal,
|
simplePeerSignal: payload.simplePeerSignal,
|
||||||
senderUserSocketId: socket.id,
|
senderUserSocketId: socket.id,
|
||||||
isGoingBackToInitiator: payload.isAnswerer,
|
isGoingBackToInitiator: payload.isAnswerer ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
io.to(payload.userSocketIdToSignal).emit(
|
io.to(payload.userSocketIdToSignal).emit(
|
||||||
|
|||||||
@@ -55,8 +55,8 @@
|
|||||||
[
|
[
|
||||||
"@electron-forge/plugin-webpack",
|
"@electron-forge/plugin-webpack",
|
||||||
{
|
{
|
||||||
"port": "4001",
|
"port": "4000",
|
||||||
"loggerPort": "9004",
|
"loggerPort": "9001",
|
||||||
"mainConfig": "./webpack.main.config.js",
|
"mainConfig": "./webpack.main.config.js",
|
||||||
"devContentSecurityPolicy": "connect-src 'self' http://localhost:5000 ws://localhost:5000 'unsafe-eval'",
|
"devContentSecurityPolicy": "connect-src 'self' http://localhost:5000 ws://localhost:5000 'unsafe-eval'",
|
||||||
"renderer": {
|
"renderer": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
import { $maxNumberActiveStreams } from "../../controller/recoil";
|
import { $maxNumberActiveStreams } from "../../controller/recoil";
|
||||||
import { $numberActiveLines } from "../../controller/recoil";
|
import { $numberActiveLines } from "../../controller/recoil";
|
||||||
@@ -21,11 +21,20 @@ function Video({ peer }: { peer: Peer }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
peer.on("stream", (remoteStream: MediaStream) => {
|
peer.on("stream", (remoteStream: MediaStream) => {
|
||||||
|
console.log("stream coming in, adding video src object");
|
||||||
|
|
||||||
if (videoRef?.current) videoRef.current.srcObject = remoteStream;
|
if (videoRef?.current) videoRef.current.srcObject = remoteStream;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
peer.on("close", () => {
|
||||||
|
console.log("remote user closed mediaconnection");
|
||||||
|
videoRef.current.height = 0;
|
||||||
|
});
|
||||||
}, [videoRef]);
|
}, [videoRef]);
|
||||||
|
|
||||||
return <video ref={videoRef} controls height={"200"} width="250" autoPlay />;
|
return (
|
||||||
|
<video ref={videoRef} controls height={"200"} width="250" autoPlay muted />
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Overlay() {
|
export default function Overlay() {
|
||||||
@@ -43,6 +52,9 @@ export default function Overlay() {
|
|||||||
|
|
||||||
const localVideoRef = useRef<HTMLVideoElement>(null);
|
const localVideoRef = useRef<HTMLVideoElement>(null);
|
||||||
|
|
||||||
|
const [localUserVideoStream, setLocalUserVideoStream] =
|
||||||
|
useState<MediaStream>(null);
|
||||||
|
|
||||||
// initially, have these set to default
|
// initially, have these set to default
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setNumActiveLines(1);
|
setNumActiveLines(1);
|
||||||
@@ -68,6 +80,8 @@ export default function Overlay() {
|
|||||||
navigator.mediaDevices
|
navigator.mediaDevices
|
||||||
.getUserMedia({ video: true, audio: true })
|
.getUserMedia({ video: true, audio: true })
|
||||||
.then((localStream: MediaStream) => {
|
.then((localStream: MediaStream) => {
|
||||||
|
setLocalUserVideoStream(localStream);
|
||||||
|
|
||||||
// show user video
|
// show user video
|
||||||
if (localVideoRef?.current)
|
if (localVideoRef?.current)
|
||||||
localVideoRef.current.srcObject = localStream;
|
localVideoRef.current.srcObject = localStream;
|
||||||
@@ -100,6 +114,7 @@ export default function Overlay() {
|
|||||||
socket.emit(SocketChannels.SEND_SIGNAL, {
|
socket.emit(SocketChannels.SEND_SIGNAL, {
|
||||||
userSocketIdToSignal: userSocketId,
|
userSocketIdToSignal: userSocketId,
|
||||||
simplePeerSignal: signal,
|
simplePeerSignal: signal,
|
||||||
|
isAnswerer: false,
|
||||||
} as SendSignal);
|
} as SendSignal);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -182,6 +197,13 @@ export default function Overlay() {
|
|||||||
setMaxNumActiveStreams((prevNum) => prevNum + 1);
|
setMaxNumActiveStreams((prevNum) => prevNum + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// handle shortcut to enable this stream if this video component is selected
|
||||||
|
const toggleMyStreamOnOrOff = useCallback(() => {
|
||||||
|
localUserVideoStream
|
||||||
|
.getTracks()
|
||||||
|
.forEach((track) => (track.enabled = !track.enabled));
|
||||||
|
}, [localUserVideoStream]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col max-w-sm">
|
<div className="flex flex-col max-w-sm">
|
||||||
{/* {[...Array(maxNumActiveStreams)].map((_n) => (
|
{/* {[...Array(maxNumActiveStreams)].map((_n) => (
|
||||||
@@ -196,6 +218,8 @@ export default function Overlay() {
|
|||||||
|
|
||||||
<video muted id="userLocalVideo" ref={localVideoRef} controls autoPlay />
|
<video muted id="userLocalVideo" ref={localVideoRef} controls autoPlay />
|
||||||
|
|
||||||
|
<button onClick={toggleMyStreamOnOrOff}>Toggle My Stream</button>
|
||||||
|
|
||||||
{localPeerConnections.map((peer) => (
|
{localPeerConnections.map((peer) => (
|
||||||
<Video peer={peer} />
|
<Video peer={peer} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BsApple, BsWindows } from "react-icons/bs";
|
import { BsApple, BsWindows } from "react-icons/bs";
|
||||||
import { FaPeopleCarry, FaRunning } from "react-icons/fa";
|
import { FaPeopleCarry, FaRunning } from "react-icons/fa";
|
||||||
|
|
||||||
import { Button } from "carbon-components-react";
|
|
||||||
import Footer from "../components/footer";
|
import Footer from "../components/footer";
|
||||||
import Header from "../components/header";
|
import Header from "../components/header";
|
||||||
import { MdOutlineNaturePeople } from "react-icons/md";
|
import { MdOutlineNaturePeople } from "react-icons/md";
|
||||||
@@ -22,8 +21,6 @@ const Home: NextPage = () => {
|
|||||||
for remote startups.
|
for remote startups.
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<Button>yoo carbon what's up</Button>
|
|
||||||
|
|
||||||
<span className="text-zinc-400 text-lg md:text-xl mt-5 text-center md:text-left">
|
<span className="text-zinc-400 text-lg md:text-xl mt-5 text-center md:text-left">
|
||||||
The <span className="text-nirvanaTeal">{"'less is more'"}</span>{" "}
|
The <span className="text-nirvanaTeal">{"'less is more'"}</span>{" "}
|
||||||
approach. Skip zoom scheduling, <br></br> slack notifications, and
|
approach. Skip zoom scheduling, <br></br> slack notifications, and
|
||||||
|
|||||||
Reference in New Issue
Block a user