1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Mirror own video.

This commit is contained in:
Juliusz Chroboczek 2020-12-03 18:38:36 +01:00
parent 29e98f4f37
commit c5638a544f
2 changed files with 11 additions and 3 deletions

View file

@ -814,6 +814,10 @@ h1 {
opacity: 0.7; opacity: 0.7;
} }
.mirror {
transform: scaleX(-1);
}
#inputform { #inputform {
width: 100%; width: 100%;
} }

View file

@ -829,7 +829,7 @@ async function addLocalMedia(id) {
c.onstats = gotUpStats; c.onstats = gotUpStats;
c.setStatsInterval(2000); c.setStatsInterval(2000);
await setMedia(c, true); await setMedia(c, true, true);
setButtonsVisibility(); setButtonsVisibility();
} }
@ -931,7 +931,7 @@ async function addFileMedia(file) {
delUpMedia(c); delUpMedia(c);
} }
}; };
setMedia(c, true, video); setMedia(c, true, false, video);
c.userdata.play = true; c.userdata.play = true;
setButtonsVisibility() setButtonsVisibility()
} }
@ -1020,11 +1020,13 @@ function muteLocalTracks(mute) {
* @param {Stream} c * @param {Stream} c
* @param {boolean} isUp * @param {boolean} isUp
* - indicates whether the stream goes in the up direction * - indicates whether the stream goes in the up direction
* @param {boolean} [mirror]
* - 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.
*/ */
function setMedia(c, isUp, video) { function setMedia(c, isUp, mirror, video) {
let peersdiv = document.getElementById('peers'); let peersdiv = document.getElementById('peers');
let div = document.getElementById('peer-' + c.id); let div = document.getElementById('peer-' + c.id);
@ -1058,6 +1060,8 @@ function setMedia(c, isUp, video) {
div.appendChild(media); div.appendChild(media);
if(!video) if(!video)
addCustomControls(media, div, c); addCustomControls(media, div, c);
if(mirror)
media.classList.add('mirror');
} }
if(!video) if(!video)