简体   繁体   English

CSS | Javascript:像视频播放器一样缩放或信使,具有动态高度和宽度

[英]CSS | Javascript: Zoom or Messenger like Video Player with dynamic height and width

In zoom conference or messenger meeting, every participant's video container take height and width dynamically.在缩放会议或信使会议中,每个参与者的视频容器都会动态获取高度和宽度。 Considering bellow picture, suppose blue box is the main container - if there is only one participant i need to give him/her(video player 1) the full width and height.考虑到下面的图片,假设蓝色框是主要容器 - 如果只有一个参与者,我需要给他/她(视频播放器 1)完整的宽度和高度。

If there are two participants, they take the height and width like pic-2 and if there are three participants, they take the height and width like pic-3 and so on..如果有两个参与者,他们会像图2一样采用高度和宽度,如果有三个参与者,他们会像图3一样采用高度和宽度,依此类推。

Is there any way to do this using css only?有没有办法只使用 css 来做到这一点? Or is there any library to do this?或者有没有图书馆可以做到这一点?

My scenario: Suppose i'm a teacher.我的场景:假设我是一名教师。 There are 10 students enroll my class.有 10 名学生报名参加我的 class。 When i start video conference, in student view - i create 3x3 grid.当我开始视频会议时,在学生视图中 - 我创建 3x3 网格。 But when someone join that conference i want to give him/her the full width and height according to main container, cause he/she is the only participant.但是当有人加入那个会议时,我想根据主容器给他/她完整的宽度和高度,因为他/她是唯一的参与者。 And other participant's grid will remain on the container who didn't join still.其他参与者的网格将保留在未加入的容器上。 If i scroll bottom i can see that.如果我滚动底部,我可以看到。 If another student join i want to give the height and width like pic-2.如果另一个学生加入,我想给出像 pic-2 这样的高度和宽度。 And if another student join like pic-3....如果另一个学生像 pic-3 一样加入......

I can do it using javascript, but i wanna do it with css.我可以用 javascript 来做,但我想用 css 来做。

Thank's.谢谢。

参考图片以更好地理解

Yes I can be done using CSS grid.是的,我可以使用 CSS 网格来完成。 Where the blue box can be a div tag where you will specify the grid.蓝色框可以是一个 div 标签,您将在其中指定网格。 The best thing about the grid is auto adjusts.关于网格的最好的事情是自动调整。 The same can also be achieved with css Flexbox. css Flexbox 也可以实现相同的目的。 I guess for your use case Flexbox would be more appropriate.我想对于您的用例 Flexbox 会更合适。 Link For Flexbox Guide Link For Grid Guide Flexbox 指南链接 网格指南链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM