This commit is contained in:
Fabian Stamm 2023-07-02 15:57:14 +02:00
commit 7ffb691922
3 changed files with 176 additions and 175 deletions

View File

@ -26,14 +26,14 @@
<h2>Your ID: <span id="streamId"></span></h2> <h2>Your ID: <span id="streamId"></span></h2>
<div id="streamURLCont"> <div id="streamURLCont">
<h2>Connect URL: <a id="streamURL"></a></h2> <h2>Connect URL: <a id="streamURL"></a></h2>
<button id="startStramBTN">Start Stream</button>
</div> </div>
<div id="connectToCont"> <div id="connectToCont">
<h2>Connecting to: <span id="connectToID"></span></h2> <h2>Connecting to: <span id="connectToID"></span></h2>
<button id="startStramBTN">Start Stream</button>
</div> </div>
</div> </div>
</div> </div>
<video id="localVideo" style="width: 100%" controls></video> <video id="localVideo" style="width: 100%" controls muted></video>
</div> </div>

View File

@ -96,7 +96,6 @@ function bitrateTransform(sdp) {
return res; return res;
} }
let currentStream = undefined; let currentStream = undefined;
peer.on("open", (id) => { peer.on("open", (id) => {
console.log("ID", id); console.log("ID", id);
@ -117,8 +116,8 @@ peer.on("open", (id) => {
video: true, video: true,
}) })
.then((stream) => { .then((stream) => {
if(currentStream) { if (currentStream) {
currentStream.getTracks().forEach(track => track.stop()) currentStream.getTracks().forEach((track) => track.stop());
} }
currentStream = stream; currentStream = stream;
let v = sf.localVideo; let v = sf.localVideo;

View File

@ -1,4 +1,6 @@
{ {
"name": "ScreenSharingThing",
"packageManager": "yarn@3.1.1",
"scripts": { "scripts": {
"build:api": "jrpc compile API/main.jrpc -o=ts-node:_API/src && yarn workspace @hibas123/screen-api build", "build:api": "jrpc compile API/main.jrpc -o=ts-node:_API/src && yarn workspace @hibas123/screen-api build",
"build:client": "yarn workspace @hibas123/screen-client build", "build:client": "yarn workspace @hibas123/screen-client build",