1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-25 01:55:57 +01:00

Display bitrate.

This commit is contained in:
Juliusz Chroboczek 2020-04-25 14:45:48 +02:00
parent 38e3260e77
commit b018b14c80
2 changed files with 29 additions and 2 deletions

View file

@ -171,6 +171,10 @@ h1 {
margin-top: 5px; margin-top: 5px;
} }
.label-fallback {
opacity: 0.5;
}
#inputform { #inputform {
width: 100%; width: 100%;
} }

View file

@ -233,12 +233,21 @@ function delMedia(id) {
mediadiv.removeChild(peer); mediadiv.removeChild(peer);
} }
function setLabel(id) { function setLabel(id, fallback) {
let label = document.getElementById('label-' + id); let label = document.getElementById('label-' + id);
if(!label) if(!label)
return; return;
let l = down[id] ? down[id].label : null; let l = down[id] ? down[id].label : null;
label.textContent = l ? l : ''; if(l) {
label.textContent = l;
label.classList.remove('label-fallback');
} else if(fallback) {
label.textContent = fallback;
label.classList.add('label-fallback');
} else {
label.textContent = '';
label.classList.remove('label-fallback');
}
} }
function serverConnect() { function serverConnect() {
@ -429,6 +438,20 @@ async function setMaxBitrate(id, audio, video) {
await s.setParameters(p); await s.setParameters(p);
} }
} }
if((audio && audio < 128000) || (video && video < 256000)) {
let l = '';
if(audio)
l = `${Math.round(audio/1000)}kbps`
if(video) {
if(l)
l = l + ' + ';
l = l + `${Math.round(video/1000)}kbps`
}
setLabel(id, l)
} else {
setLabel(id);
}
} }
async function addIceCandidates(conn) { async function addIceCandidates(conn) {