From 8e977b477222702d55915fa6d955e8abdbd41dac Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 28 Apr 2022 11:08:49 -0500 Subject: [PATCH] trying a dummy one broadcaster method but not receiving own stream for somereason --- packages/api/routes/rtc.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/api/routes/rtc.ts b/packages/api/routes/rtc.ts index 6036673..fac4bff 100644 --- a/packages/api/routes/rtc.ts +++ b/packages/api/routes/rtc.ts @@ -18,6 +18,8 @@ const linesStreams: { [lineId: string]: any[]; } = {}; +let testMainStream: any = null; + async function handleJoin(req: Request, res: Response) { try { const { lineId } = req.params; @@ -41,12 +43,8 @@ async function handleJoin(req: Request, res: Response) { // now that remote is set // allow this peer connection for this specific line to get tracks for this line already try { - linesStreams[lineId]?.forEach((stream: any) => { - console.log(`have streams in this line`, stream); - - stream.getTracks().forEach((track: any) => { - peer.addTrack(track, stream); - }); + testMainStream?.getTracks().forEach((track: any) => { + peer.addTrack(track, testMainStream); }); } catch (e) { console.log(`hacking around small problem with adding track`, e); @@ -83,5 +81,8 @@ function handleStreams(e: any, peer: any, lineId: string) { linesStreams[lineId] = [e.streams[0]]; } + // dumb smoke test + testMainStream = e.streams[0]; + console.log(linesStreams); }