Bitrate trials webrtc
This commit is contained in:
parent
2a928381ec
commit
9fe48fab77
|
@ -130,3 +130,5 @@ dist
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
.well-known
|
||||||
|
.well-known/*
|
|
@ -20,6 +20,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="index.js?v=16"></script>
|
<script src="index.js?v=32"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -53,6 +53,8 @@ let videoContainer = document.querySelector(".videolist");
|
||||||
|
|
||||||
let activePeerInfos = {};
|
let activePeerInfos = {};
|
||||||
let activePeer = null;
|
let activePeer = null;
|
||||||
|
let maxbitrate;
|
||||||
|
let resulation;
|
||||||
|
|
||||||
function connect()
|
function connect()
|
||||||
{
|
{
|
||||||
|
@ -142,6 +144,25 @@ async function beginEngine()
|
||||||
|
|
||||||
let url = new URL(window.location);
|
let url = new URL(window.location);
|
||||||
roomid = url.searchParams.get("room");
|
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)
|
if(!!roomid == 0)
|
||||||
{
|
{
|
||||||
let hash = window.crypto.randomUUID();
|
let hash = window.crypto.randomUUID();
|
||||||
|
@ -162,16 +183,21 @@ window.addEventListener("load", () => {
|
||||||
async function startOutgoingWebcam()
|
async function startOutgoingWebcam()
|
||||||
{
|
{
|
||||||
outgoingStream = await navigator.mediaDevices.getUserMedia({
|
outgoingStream = await navigator.mediaDevices.getUserMedia({
|
||||||
video: true,/*{
|
video: /*true*/{
|
||||||
advanced: [
|
advanced: [
|
||||||
|
{ width: { exact: 1920 } },
|
||||||
|
{ width: { exact: 1600 } },
|
||||||
|
{ width: { exact: 1366 } },
|
||||||
|
{ width: { exact: 1280 } },
|
||||||
{ width: { exact: 1024 } },
|
{ width: { exact: 1024 } },
|
||||||
{ width: { exact: 900 } },
|
{ width: { exact: 900 } },
|
||||||
{ width: { exact: 800 } },
|
{ width: { exact: 800 } },
|
||||||
{ width: { exact: 640 } },
|
{ width: { exact: 640 } },
|
||||||
{ width: { exact: 320 } },
|
{ width: { exact: 320 } },
|
||||||
{ width: { exact: 240 } }
|
{ width: { exact: 240 } }
|
||||||
]
|
],
|
||||||
}*/
|
facingMode: "user"
|
||||||
|
},/**/
|
||||||
audio: false
|
audio: false
|
||||||
});
|
});
|
||||||
outgoingStreamOnlyVideo = new MediaStream(outgoingStream);
|
outgoingStreamOnlyVideo = new MediaStream(outgoingStream);
|
||||||
|
@ -270,16 +296,17 @@ setInterval(()=>{
|
||||||
getStats()
|
getStats()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
/*
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if(activePeer?.turboBitrate == 0)
|
if(activePeer?.turboBitrate === 0)
|
||||||
{
|
{
|
||||||
const senders = activePeer.getSenders();
|
const senders = activePeer.getSenders();
|
||||||
const videoSender = senders.find(sender => sender.track?.kind === 'video');
|
const videoSender = senders.find(sender => sender.track?.kind === 'video');
|
||||||
if(videoSender)
|
if(videoSender)
|
||||||
{
|
{
|
||||||
const parameters = videoSender.getParameters();
|
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(() => {
|
videoSender.setParameters(parameters).then(() => {
|
||||||
// console.log('Bitrate değiştirildi.');
|
// console.log('Bitrate değiştirildi.');
|
||||||
activePeer.turboBitrate = 1;
|
activePeer.turboBitrate = 1;
|
||||||
|
@ -291,7 +318,7 @@ setInterval(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
*/
|
|
||||||
let relative;
|
let relative;
|
||||||
|
|
||||||
async function getStats()
|
async function getStats()
|
||||||
|
|
Loading…
Reference in New Issue