rtc

minimal webrtc client
git clone https://git.ce9e.org/rtc.git

commit
b84f50a003e4f4fa10a452e8a79a73a4252d1a20
parent
bcde335558213cb6e239736a6a381828c0fcfd2d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-04-03 17:42
Revert "ideal columns"

This reverts commit 7f92934771a25cc21792510a2072ff24c934d721.

Diffstat

M www/rtc/rtc.css 2 +-
M www/rtc/rtc.js 14 --------------

2 files changed, 1 insertions, 15 deletions


diff --git a/www/rtc/rtc.css b/www/rtc/rtc.css

@@ -18,7 +18,7 @@ body {
   18    18 
   19    19 .rtc-videos {
   20    20 	display: grid;
   21    -1 	grid-template-columns: repeat(auto-fit, minmax(var(--video-width), 1fr));
   -1    21 	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
   22    22 	align-content: center;
   23    23 	justify-items: center;
   24    24 	grid-gap: 1em;

diff --git a/www/rtc/rtc.js b/www/rtc/rtc.js

@@ -18,16 +18,6 @@
   18    18 	var localVideo = document.querySelector('.rtc-videos video.local');
   19    19 	localVideo.srcObject = new MediaStream();
   20    20 
   21    -1 	var updateIdealColumns = function() {
   22    -1 		// FIXME: container.clientHeight depends on content (on mobile) -> circular
   23    -1 		var items = container.children.length;
   24    -1 		var contentRatio = 6 / 4;
   25    -1 		var screenWidth = container.clientWidth;
   26    -1 		var screenHeight = container.clientHeight;
   27    -1 		var width = Math.sqrt(screenWidth * screenHeight / contentRatio / items);
   28    -1 		container.style.setProperty('--video-width', width + 'px');
   29    -1 	};
   30    -1 
   31    21 	var closeConnection = function(sender) {
   32    22 		if (sender in cons) {
   33    23 			cons[sender].video.remove();
@@ -44,7 +34,6 @@
   44    34 		var video = document.createElement('video');
   45    35 		video.autoplay = true;
   46    36 		container.append(video);
   47    -1 		updateIdealColumns();
   48    37 
   49    38 		var con = new RTCPeerConnection({
   50    39 			iceServers: [{urls: 'stun:ce9e.org:3478'}],
@@ -255,7 +244,4 @@
  255   244 			}
  256   245 		});
  257   246 	});
  258    -1 
  259    -1 	updateIdealColumns();
  260    -1 	window.addEventListener('resize', updateIdealColumns);
  261   247 })();