more progress but calling not working now
This commit is contained in:
Vendored
+1
-1
@@ -8,7 +8,7 @@
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"workbench.colorTheme": "Default Light+",
|
||||
"javascript.format.semicolons": "insert",
|
||||
"window.zoomLevel": 1
|
||||
"window.zoomLevel": 0
|
||||
|
||||
// "eslint.workingDirectories": ["./packages/desktop"]
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
[
|
||||
"@electron-forge/plugin-webpack",
|
||||
{
|
||||
"port": "4005",
|
||||
"loggerPort": "9005",
|
||||
"port": "4000",
|
||||
"loggerPort": "9000",
|
||||
"mainConfig": "./webpack.main.config.js",
|
||||
"devContentSecurityPolicy": "connect-src 'self' http://localhost:5000 ws://localhost:5000 https://api.quotable.io/random 'unsafe-eval'",
|
||||
"renderer": {
|
||||
|
||||
@@ -16,6 +16,35 @@ import useTerminalProvider from './TerminalProvider';
|
||||
import MasterLineData from '@nirvana/core/models/masterLineData.model';
|
||||
import { useEffectOnce } from 'react-use';
|
||||
|
||||
const iceServers = [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun1.l.google.com:19302' },
|
||||
{ urls: 'stun:stun2.l.google.com:19302' },
|
||||
{ urls: 'stun:stun3.l.google.com:19302' },
|
||||
{ urls: 'stun:stun4.l.google.com:19302' },
|
||||
{
|
||||
url: 'turn:numb.viagenie.ca',
|
||||
credential: 'muazkh',
|
||||
username: 'webrtc@live.com',
|
||||
},
|
||||
{
|
||||
url: 'turn:numb.viagenie.ca',
|
||||
credential: 'muazkh',
|
||||
username: 'webrtc@live.com',
|
||||
},
|
||||
{
|
||||
url: 'turn:192.158.29.39:3478?transport=udp',
|
||||
credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
|
||||
username: '28224511:1379330808',
|
||||
},
|
||||
{
|
||||
url: 'turn:192.158.29.39:3478?transport=tcp',
|
||||
credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
|
||||
username: '28224511:1379330808',
|
||||
},
|
||||
];
|
||||
|
||||
type LinePeerMap = {
|
||||
[lineId: string]: { userId: string; peer: Peer; mediaStream?: MediaStream }[];
|
||||
};
|
||||
@@ -46,18 +75,10 @@ export function StreamProvider({ children }: { children: React.ReactChild }) {
|
||||
|
||||
const peerForMeAndNewbie = new Peer({
|
||||
initiator: false,
|
||||
trickle: true, // prevents the multiple tries on different ice servers and signal from getting called a bunch of times
|
||||
trickle: false, // prevents the multiple tries on different ice servers and signal from getting called a bunch of times
|
||||
stream: userLocalStream,
|
||||
config: {
|
||||
iceServers: [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:global.stun.twilio.com:3478?transport=udp' },
|
||||
{
|
||||
url: 'turn:numb.viagenie.ca',
|
||||
credential: 'muazkh',
|
||||
username: 'webrtc@live.com',
|
||||
},
|
||||
],
|
||||
iceServers,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -223,19 +244,11 @@ function LineConnector({
|
||||
const connectingToast = toast.loading('calling peer for a snappy experience');
|
||||
|
||||
const localPeerConnection = new Peer({
|
||||
initiator: true,
|
||||
initiator: false,
|
||||
stream: localMediaStream,
|
||||
trickle: true, // prevents the multiple tries on different ice servers and signal from getting called a bunch of times,
|
||||
config: {
|
||||
iceServers: [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:global.stun.twilio.com:3478?transport=udp' },
|
||||
{
|
||||
url: 'turn:numb.viagenie.ca',
|
||||
credential: 'muazkh',
|
||||
username: 'webrtc@live.com',
|
||||
},
|
||||
],
|
||||
iceServers,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -248,11 +261,11 @@ function LineConnector({
|
||||
);
|
||||
|
||||
toast.dismiss(connectingToast);
|
||||
});
|
||||
|
||||
// sending back the connection to the parent
|
||||
// so that we can accept the answer later on
|
||||
handleAddPeer(lineId, memberId, localPeerConnection, localMediaStream);
|
||||
// sending back the connection to the parent
|
||||
// so that we can accept the answer later on
|
||||
handleAddPeer(lineId, memberId, localPeerConnection, localMediaStream);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -45,45 +45,3 @@ export default function MainPanel() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LineStreams({ broadcasters }: { broadcasters: string[] }) {
|
||||
const { peerMap } = useStreams();
|
||||
|
||||
console.log(peerMap);
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
{broadcasters?.map((userId) => {
|
||||
const currentPeer = peerMap[userId];
|
||||
|
||||
return currentPeer && <Stream key={`streamDisplay-${userId}`} peer={currentPeer} />;
|
||||
})}
|
||||
this is the list of current streams we are going to show
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Stream({ peer }: { peer: Peer }) {
|
||||
const streamRef = useRef<HTMLVideoElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
peer.on('stream', (remotePeerStream: MediaStream) => {
|
||||
console.log(
|
||||
'stream coming in from remote peer...BUT, only going to show once they broadcast',
|
||||
);
|
||||
console.log(peer);
|
||||
|
||||
// const audio = new Audio();
|
||||
// audio.autoplay = true;
|
||||
// audio.srcObject = remotePeerStream;
|
||||
|
||||
if (streamRef?.current) streamRef.current.srcObject = remotePeerStream;
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
this is a stream component of one remote peer
|
||||
<video height={400} width={400} autoPlay muted ref={streamRef} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user