简体   繁体   English

如何在短时间内获得网页可以播放的最大视频数

[英]How to get the max number videos a web page can play, in a short time

I want to open 16 live stream 1080P videos at the same time, but in some customers' computers, it will cause the browser to crash.我想同时打开16个直播1080P视频,但是在一些客户的电脑上,会导致浏览器崩溃。

In order to avoid this, I have to get browser performance before playing that many.为了避免这种情况,我必须在玩那么多游戏之前获得浏览器性能。 Now I play one video, and record the current page refresh rate by 'requestAnimationFrame', if the refresh rate is over 24, destroy previously created video, then play two videos, continue until the refresh rate less than 24. The last result is the number of video I can play, but the method cost too much time, is there a method can control the detection time within 3 seconds?现在播放一个视频,并通过'requestAnimationFrame'记录当前页面刷新率,如果刷新率超过24,则销毁之前创建的视频,然后播放两个视频,直到刷新率小于24。最后的结果是可以播放多少个视频,但是这个方法太费时间了,有没有什么方法可以把检测时间控制在3秒以内?

By the way, I use the WebRTC to live stream.顺便说一下,我使用 WebRTC 进行直播。

There will not be a simple answer to this unfortunately - different streams and codecs will have different loads on different browsers, or even on the same browser on different systems.不幸的是,对此不会有一个简单的答案——不同的流和编解码器在不同的浏览器上会有不同的负载,甚至在不同系统上的同一个浏览器上。

Video playback support is tied closely to the capabilities of the platform the browser is running on, typically - if the codec is supported in HW for example, playback will usually require less CPU, battery etc. Even with HW support when you have so many videos most platforms will struggle.视频播放支持与运行浏览器的平台的功能密切相关,通常 - 例如,如果硬件支持编解码器,播放通常需要更少的 CPU、电池等。即使有硬件支持,当你有这么多视频时大多数平台都会挣扎。

One way to work around this problem is to combine all your video feeds into a single stream on the server side.解决此问题的一种方法是将所有视频源合并到服务器端的单个流中。

You can then display this combine video so that if someone clicks on a particular part of the video, corresponding to a particular stream, you can switch to just that stream or maybe have a separate window to show the selected stream in larger or better quality.然后,您可以显示此组合视频,以便如果有人点击视频的特定部分(对应于特定流),您可以只切换到该流,或者可能有一个单独的窗口以更大或更好的质量显示所选流。

It puts more work on the server side but this may be a treasonable tradeoff depending on your needs.它在服务器端投入了更多的工作,但根据您的需要,这可能是一个叛国的权衡。

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

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