diff --git a/.gitignore b/.gitignore index ceaea36..7c43573 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,5 @@ dist .yarn/install-state.gz .pnp.* +.well-known +.well-known/* \ No newline at end of file diff --git a/public/index.html b/public/index.html index 4d6cb43..5e59258 100644 --- a/public/index.html +++ b/public/index.html @@ -20,6 +20,6 @@ - + \ No newline at end of file diff --git a/public/index.js b/public/index.js index 7dea7f9..7a1dd05 100644 --- a/public/index.js +++ b/public/index.js @@ -53,6 +53,8 @@ let videoContainer = document.querySelector(".videolist"); let activePeerInfos = {}; let activePeer = null; +let maxbitrate; +let resulation; function connect() { @@ -142,6 +144,25 @@ async function beginEngine() let url = new URL(window.location); roomid = url.searchParams.get("room"); + + if(url.searchParams.get("maxbitrate")) + { + let n = Number(url.searchParams.get("maxbitrate")); + if(Number.isFinite(n) && !Number.isNaN(n)) + { + maxbitrate = n; + }else maxbitrate = 3_000_000; + }else maxbitrate = 3_000_000; + + if(url.searchParams.get("resulation")) + { + let n = Number(url.searchParams.get("resulation")); + if(Number.isFinite(n) && !Number.isNaN(n)) + { + resulation = n; + }else resulation = 1.5; + }else resulation = 1.5; + if(!!roomid == 0) { let hash = window.crypto.randomUUID(); @@ -162,16 +183,21 @@ window.addEventListener("load", () => { async function startOutgoingWebcam() { outgoingStream = await navigator.mediaDevices.getUserMedia({ - video: true,/*{ + video: /*true*/{ advanced: [ + { width: { exact: 1920 } }, + { width: { exact: 1600 } }, + { width: { exact: 1366 } }, + { width: { exact: 1280 } }, { width: { exact: 1024 } }, { width: { exact: 900 } }, { width: { exact: 800 } }, { width: { exact: 640 } }, { width: { exact: 320 } }, { width: { exact: 240 } } - ] - }*/ + ], + facingMode: "user" + },/**/ audio: false }); outgoingStreamOnlyVideo = new MediaStream(outgoingStream); @@ -270,16 +296,17 @@ setInterval(()=>{ getStats() }, 1000) -/* + setInterval(() => { - if(activePeer?.turboBitrate == 0) + if(activePeer?.turboBitrate === 0) { const senders = activePeer.getSenders(); const videoSender = senders.find(sender => sender.track?.kind === 'video'); if(videoSender) { const parameters = videoSender.getParameters(); - parameters.encodings[0].maxBitrate = 3_000_000; + parameters.encodings[0].maxBitrate = maxbitrate; + parameters.encodings[0].scaleResolutionDownBy = resulation; videoSender.setParameters(parameters).then(() => { // console.log('Bitrate değiştirildi.'); activePeer.turboBitrate = 1; @@ -291,7 +318,7 @@ setInterval(() => { } } }, 5000); -*/ + let relative; async function getStats()