mirror of
https://github.com/jech/galene.git
synced 2024-11-12 19:55:59 +01:00
Remove isUp parameter from setMedia.
It's redundant, the data is already in the stream.
This commit is contained in:
parent
1f3328b441
commit
ae782f5d00
1 changed files with 10 additions and 12 deletions
|
@ -367,7 +367,7 @@ function gotDownStream(c) {
|
||||||
displayError(e);
|
displayError(e);
|
||||||
};
|
};
|
||||||
c.ondowntrack = function(track, transceiver, label, stream) {
|
c.ondowntrack = function(track, transceiver, label, stream) {
|
||||||
setMedia(c, false);
|
setMedia(c);
|
||||||
};
|
};
|
||||||
c.onnegotiationcompleted = function() {
|
c.onnegotiationcompleted = function() {
|
||||||
resetMedia(c);
|
resetMedia(c);
|
||||||
|
@ -379,7 +379,7 @@ function gotDownStream(c) {
|
||||||
if(getSettings().activityDetection)
|
if(getSettings().activityDetection)
|
||||||
c.setStatsInterval(activityDetectionInterval);
|
c.setStatsInterval(activityDetectionInterval);
|
||||||
|
|
||||||
setMedia(c, false);
|
setMedia(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store current browser viewport height in css variable
|
// Store current browser viewport height in css variable
|
||||||
|
@ -1311,7 +1311,7 @@ async function replaceUpStream(c) {
|
||||||
let media = /** @type{HTMLVideoElement} */
|
let media = /** @type{HTMLVideoElement} */
|
||||||
(document.getElementById('media-' + c.localId));
|
(document.getElementById('media-' + c.localId));
|
||||||
setUpStream(cn, c.stream);
|
setUpStream(cn, c.stream);
|
||||||
await setMedia(cn, true,
|
await setMedia(cn,
|
||||||
cn.label == 'camera' && getSettings().mirrorView,
|
cn.label == 'camera' && getSettings().mirrorView,
|
||||||
cn.label == 'video' && media);
|
cn.label == 'video' && media);
|
||||||
return cn;
|
return cn;
|
||||||
|
@ -1411,7 +1411,7 @@ async function addLocalMedia(localId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setUpStream(c, stream);
|
setUpStream(c, stream);
|
||||||
await setMedia(c, true, settings.mirrorView);
|
await setMedia(c, settings.mirrorView);
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ async function addShareMedia() {
|
||||||
let c = newUpStream();
|
let c = newUpStream();
|
||||||
c.label = 'screenshare';
|
c.label = 'screenshare';
|
||||||
setUpStream(c, stream);
|
setUpStream(c, stream);
|
||||||
await setMedia(c, true);
|
await setMedia(c);
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1495,7 +1495,7 @@ async function addFileMedia(file) {
|
||||||
displayWarning('You have been muted');
|
displayWarning('You have been muted');
|
||||||
}
|
}
|
||||||
|
|
||||||
await setMedia(c, true, false, video);
|
await setMedia(c, false, video);
|
||||||
c.userdata.play = true;
|
c.userdata.play = true;
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
}
|
}
|
||||||
|
@ -1671,15 +1671,13 @@ function scheduleReconsiderDownRate() {
|
||||||
* setMedia adds a new media element corresponding to stream c.
|
* setMedia adds a new media element corresponding to stream c.
|
||||||
*
|
*
|
||||||
* @param {Stream} c
|
* @param {Stream} c
|
||||||
* @param {boolean} isUp
|
|
||||||
* - indicates whether the stream goes in the up direction
|
|
||||||
* @param {boolean} [mirror]
|
* @param {boolean} [mirror]
|
||||||
* - whether to mirror the video
|
* - whether to mirror the video
|
||||||
* @param {HTMLVideoElement} [video]
|
* @param {HTMLVideoElement} [video]
|
||||||
* - the video element to add. If null, a new element with custom
|
* - the video element to add. If null, a new element with custom
|
||||||
* controls will be created.
|
* controls will be created.
|
||||||
*/
|
*/
|
||||||
async function setMedia(c, isUp, mirror, video) {
|
async function setMedia(c, mirror, video) {
|
||||||
let peersdiv = document.getElementById('peers');
|
let peersdiv = document.getElementById('peers');
|
||||||
|
|
||||||
let div = document.getElementById('peer-' + c.localId);
|
let div = document.getElementById('peer-' + c.localId);
|
||||||
|
@ -1697,7 +1695,7 @@ async function setMedia(c, isUp, mirror, video) {
|
||||||
media = video;
|
media = video;
|
||||||
} else {
|
} else {
|
||||||
media = document.createElement('video');
|
media = document.createElement('video');
|
||||||
if(isUp)
|
if(c.up)
|
||||||
media.muted = true;
|
media.muted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1717,7 +1715,7 @@ async function setMedia(c, isUp, mirror, video) {
|
||||||
if(!video && media.srcObject !== c.stream)
|
if(!video && media.srcObject !== c.stream)
|
||||||
media.srcObject = c.stream;
|
media.srcObject = c.stream;
|
||||||
|
|
||||||
if(!isUp) {
|
if(!c.up) {
|
||||||
media.onfullscreenchange = function(e) {
|
media.onfullscreenchange = function(e) {
|
||||||
forceDownRate(c.id, document.fullscreenElement === media, false);
|
forceDownRate(c.id, document.fullscreenElement === media, false);
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1735,7 @@ async function setMedia(c, isUp, mirror, video) {
|
||||||
showVideo();
|
showVideo();
|
||||||
resizePeers();
|
resizePeers();
|
||||||
|
|
||||||
if(!isUp && isSafari() && !findUpMedia('camera')) {
|
if(!c.up && isSafari() && !findUpMedia('camera')) {
|
||||||
// Safari doesn't allow autoplay unless the user has granted media access
|
// Safari doesn't allow autoplay unless the user has granted media access
|
||||||
try {
|
try {
|
||||||
let stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
let stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
||||||
|
|
Loading…
Reference in a new issue