Bitrate trials webrtc
This commit is contained in:
parent
2a928381ec
commit
9fe48fab77
|
@ -130,3 +130,5 @@ dist
|
|||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
.well-known
|
||||
.well-known/*
|
|
@ -20,6 +20,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="index.js?v=16"></script>
|
||||
<script src="index.js?v=32"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue