I am trying to create a video conferencing like grid. I am trying using css-grid but somehow I am not being able to accomplish what I am looking for. The idea is simple, have a grid of videos on screen and paginate the videos to next page which doesn't fit in the first.
I tried using the following:
<div className="videoContainer">
<div className="videoWrapper">Cam 1</div>
<div className="videoWrapper">Cam 2</div>
<div className="videoWrapper">Cam 3</div>
</div>
CSS
.videoContainer {
display: grid;
width: 100%;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
border: 2px solid blue;
}
.videoWrapper {
display: flex;
align-items: center;
justify-content: center;
min-height: 250px;
border: 1px solid green;
}
What I am looking for is some pointers/ hints/ any articles(didn't find anything useful) that point to the direction I want to go.
I have a simple layout as follows to explain (Left column for large screen devices, right column for mobile devices):
CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives. Like tables, grid layout enables an author to align elements into columns and rows.
To make an element into a grid container, we need to use either the display: grid; or the display: inline-grid; property. The former results in a block-level grid, while the latter leads to an inline-level grid. In the CSS, we use the display: grid; property on the . container element to create a block-level CSS Grid.
You can "nest" grids by making a grid item a grid container. These grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. This makes it difficult to line nested grid items up with the main grid.
Grid Layout The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning.
An HTML element becomes a grid container when its display property is set to grid or inline-grid. All direct children of the grid container automatically become grid items. The vertical lines of grid items are called columns.
An HTML element becomes a grid container when its display property is set to grid or inline-grid. All direct children of the grid container automatically become grid items. The vertical lines of grid items are called columns. The horizontal lines of grid items are called rows.
The horizontal lines of grid items are called rows. The spaces between each column/row are called gaps. The grid-column-gap property sets the gap between the columns: The grid-row-gap property sets the gap between the rows:
I do not recommend using widths and heights with percentages. The important thing here is to respect the aspec ratio.
Example:
https://alicunde.github.io/Videoconference-Dish-CSS-JS/
Code:
https://github.com/Alicunde/Videoconference-Dish-CSS-JS
I have solved this problem today. First I started using CSS3 Grid, but the result did not respect the aspect ratio of the cameras.
Then I tried Flex, but it is not possible to cover defined surfaces. So I have created this pretty basic script.
The rest of the screens you need are easy to develop.
Phone version:
It is fast (resize event, load event):
Excuse my English.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With