mirror of
https://github.com/jech/galene.git
synced 2024-11-12 19:55:59 +01:00
Check media status in setMediaStatus.
This commit is contained in:
parent
a4d0741704
commit
1e977213d1
1 changed files with 8 additions and 8 deletions
|
@ -527,7 +527,7 @@ function setMedia(id) {
|
||||||
|
|
||||||
media.srcObject = c.stream;
|
media.srcObject = c.stream;
|
||||||
setLabel(id);
|
setLabel(id);
|
||||||
setMediaStatus(id, false);
|
setMediaStatus(id);
|
||||||
|
|
||||||
resizePeers();
|
resizePeers();
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,11 @@ function delMedia(id) {
|
||||||
resizePeers();
|
resizePeers();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMediaStatus(id, good) {
|
function setMediaStatus(id) {
|
||||||
|
let c = up[id] || down[id];
|
||||||
|
let state = c && c.pc && c.pc.iceConnectionState;
|
||||||
|
let good = state === 'connected' || state === 'completed';
|
||||||
|
|
||||||
let media = document.getElementById('media-' + id);
|
let media = document.getElementById('media-' + id);
|
||||||
if(!media) {
|
if(!media) {
|
||||||
console.warn('Setting status of unknown media.');
|
console.warn('Setting status of unknown media.');
|
||||||
|
@ -737,9 +741,7 @@ async function gotOffer(id, labels, offer) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pc.oniceconnectionstatechange = e => {
|
pc.oniceconnectionstatechange = e => {
|
||||||
setMediaStatus(id,
|
setMediaStatus(id);
|
||||||
pc.iceConnectionState === 'connected' ||
|
|
||||||
pc.iceConnectionState === 'completed');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.pc.ontrack = function(e) {
|
c.pc.ontrack = function(e) {
|
||||||
|
@ -1195,9 +1197,7 @@ async function newUpStream(id) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pc.oniceconnectionstatechange = e => {
|
pc.oniceconnectionstatechange = e => {
|
||||||
setMediaStatus(id,
|
setMediaStatus(id);
|
||||||
pc.iceConnectionState === 'connected' ||
|
|
||||||
pc.iceConnectionState === 'completed');
|
|
||||||
if(pc.iceConnectionState === 'failed') {
|
if(pc.iceConnectionState === 'failed') {
|
||||||
try {
|
try {
|
||||||
pc.restartIce();
|
pc.restartIce();
|
||||||
|
|
Loading…
Reference in a new issue