Skip to content

Commit bdbb791

Browse files
committed
Add an apps autoplay check
1 parent f4608c3 commit bdbb791

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@guardian/ab-core": "8.0.0",
3030
"@guardian/ab-testing-config": "workspace:ab-testing-config",
3131
"@guardian/braze-components": "22.2.0",
32-
"@guardian/bridget": "8.7.0",
32+
"@guardian/bridget": "8.8.0-2026-03-05",
3333
"@guardian/browserslist-config": "6.1.0",
3434
"@guardian/cdk": "62.3.5",
3535
"@guardian/commercial-core": "29.0.0",

dotcom-rendering/src/components/SelfHostedVideo.importable.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
submitComponentEvent,
1010
} from '../client/ophan/ophan';
1111
import type { ArticleFormat } from '../lib/articleFormat';
12+
import { getVideoClient } from '../lib/bridgetApi';
1213
import { getZIndex } from '../lib/getZIndex';
1314
import { generateImageURL } from '../lib/image';
1415
import { useIsInView } from '../lib/useIsInView';
@@ -424,7 +425,16 @@ export const SelfHostedVideo = ({
424425
* 3. Creates event listeners to control playback when there are multiple videos.
425426
*/
426427
useEffect(() => {
427-
setIsAutoplayAllowed(doesUserPermitAutoplay());
428+
// check the rendering taget and set autoplay setting dependent on that
429+
430+
if (renderingTarget === 'Apps') {
431+
const videoClient = getVideoClient();
432+
void videoClient.isAutoplayEnabled().then((success: boolean) => {
433+
setIsAutoplayAllowed(success);
434+
});
435+
} else {
436+
setIsAutoplayAllowed(doesUserPermitAutoplay());
437+
}
428438

429439
/**
430440
* Initialise Ophan attention tracking
@@ -513,7 +523,7 @@ export const SelfHostedVideo = ({
513523
handlePageBecomesVisible();
514524
});
515525
};
516-
}, [uniqueId, atomId]);
526+
}, [uniqueId, atomId, renderingTarget]);
517527

518528
/**
519529
* Track the first time the video comes into view.

pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)