Skip to content

Commit bda9a75

Browse files
committed
Pause videos
1 parent 9900170 commit bda9a75

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ By default, the library applies the following optimisations to the scenarios to
3838
- Pause the Slick slider autoplay
3939
- Pause the Swiper slider autoplay
4040
- Force oembed-lazyload videos to not load
41+
- Stop the HTML video and go to the second one
4142
- Wait for fonts to load
4243
- Wait for the page to load completely
4344
- Allow setting the `cookiePath` for the cookies.json globally to apply to all scenarios. If set in the scenario configuration, it will override the global configuration.

addons/setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ module.exports = async (page, scenario, config) => {
7171
iframe.loading = 'eager';
7272
});
7373

74+
// Pause videos.
75+
document.querySelectorAll('video').forEach((video) => {
76+
video.pause();
77+
video.autoplay = false;
78+
video.currentTime = 1;
79+
});
80+
7481
// Avoid Slick carousel autoplay.
7582
if (typeof $ == 'undefined' && typeof jQuery == 'function') {
7683
window.$ = jQuery;

0 commit comments

Comments
 (0)