From d210f2f2e7074aba28b4440233c956dfcee54489 Mon Sep 17 00:00:00 2001 From: George Politis Date: Tue, 8 Oct 2019 11:34:25 +0200 Subject: [PATCH] Adds a noAutoPlayVideo configuration option (used in testing). (#4714) This adds an option to disable video autoplay that will be used mostly with maleus (our selenium-based load testing tool for testing the new bridge). Disabling video rendering lowers the resource utilisation of the selenium nodes. --- config.js | 4 +++ modules/UI/videolayout/LocalVideo.js | 2 +- modules/UI/videolayout/SmallVideo.js | 2 +- .../base/media/components/web/Video.js | 12 +++++-- .../base/media/components/web/VideoTrack.js | 31 ++++++++++++++-- .../large-video/components/LargeVideo.web.js | 35 +++++++++++++++++-- 6 files changed, 76 insertions(+), 10 deletions(-) diff --git a/config.js b/config.js index c877d3d84..d38dfbfa4 100644 --- a/config.js +++ b/config.js @@ -60,6 +60,10 @@ var config = { // Enables the test specific features consumed by jitsi-meet-torture // testMode: false + + // Disables the auto-play behavior of *all* newly created video element. + // This is useful when the client runs on a host with limited resources. + // noAutoPlayVideo: false }, // Disables ICE/UDP by filtering out local and remote UDP candidates in diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index 43c329146..0234b8a02 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -273,7 +273,7 @@ LocalVideo.prototype._updateVideoElement = function() { // case video does not autoplay. const video = this.container.querySelector('video'); - video && video.play(); + video && !config.testing?.noAutoPlayVideo && video.play(); }; export default LocalVideo; diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 4cc6e95e7..8db3eb0a5 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -199,7 +199,7 @@ SmallVideo.createStreamElement = function(stream) { element.muted = true; } - element.autoplay = true; + element.autoplay = !config.testing?.noAutoPlayVideo; element.id = SmallVideo.getStreamElementID(stream); return element; diff --git a/react/features/base/media/components/web/Video.js b/react/features/base/media/components/web/Video.js index 8b678d811..3311a8920 100644 --- a/react/features/base/media/components/web/Video.js +++ b/react/features/base/media/components/web/Video.js @@ -26,7 +26,13 @@ type Props = { /** * The JitsiLocalTrack to display. */ - videoTrack: ?Object + videoTrack: ?Object, + + /** + * Used to determine the value of the autoplay attribute of the underlying + * video element. + */ + autoPlay: boolean }; /** @@ -44,7 +50,7 @@ class Video extends Component { */ static defaultProps = { className: '', - + autoPlay: true, id: '' }; @@ -131,7 +137,7 @@ class Video extends Component { render() { return (