Skip to content

Commit 23ca62f

Browse files
authored
Merge pull request #13783 from bbc/WS-2031-simorgh-dazzler-stream
WS-2288 Implement Dazzler Edge Plugin & Temporal Polyfill in Simorgh
2 parents 391248b + cae4c7f commit 23ca62f

6 files changed

Lines changed: 80 additions & 4 deletions

File tree

src/app/components/MediaLoader/configs/liveMedia.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@ import moment from 'moment';
33
import { LIVE_TV_PAGE } from '#app/routes/utils/pageTypes';
44
import onClient from '#app/lib/utilities/onClient';
55
import buildIChefURL from '#app/lib/utilities/ichefURL';
6+
import { getEnvConfig } from '#app/lib/utilities/getEnvConfig';
67
import { ConfigBuilderProps, ConfigBuilderReturnProps } from '../types';
78

89
export default ({
910
blocks,
1011
basePlayerConfig,
1112
pageType,
13+
lang,
1214
}: ConfigBuilderProps): ConfigBuilderReturnProps => {
1315
const { model: liveMediaBlock } = filterForBlockType(blocks, 'liveMedia');
1416
let warning: string | null = null;
15-
1617
const {
1718
imageUrlTemplate: holdingImageURL,
1819
version: video,
1920
title,
2021
synopses: { short },
22+
masterbrand: { id },
2123
} = liveMediaBlock;
22-
2324
const {
2425
warnings,
2526
serviceId: serviceID,
@@ -77,6 +78,22 @@ export default ({
7778
summary: short,
7879
...(warning && { warning }),
7980
},
81+
// Currently no simple way to determine from the data wether to load the plugin, as a Dazzler stream can't be distinguished from media collection items in TIPO.
82+
plugins: {
83+
toLoad: [
84+
{
85+
html: 'https://ws-dazzler-web-statics-dev.s3.eu-west-1.amazonaws.com/plugin/DazzlerEdgePlugin.js',
86+
playerOnly: true,
87+
// @ts-expect-error - this is a custom property used to pass data to the plugin when it initializes
88+
data: {
89+
env: getEnvConfig().SIMORGH_APP_ENV === 'live' ? 'live' : 'test',
90+
sid: id,
91+
holdingImageURL: holdingImageURLForLiveTV,
92+
uiLanguage: lang,
93+
},
94+
},
95+
],
96+
},
8097
},
8198
mediaType: 'video',
8299
showAds: false,

src/app/components/MediaLoader/utils/buildSettings.client.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,21 @@ describe('buildSettings', () => {
14141414
summary: 'Toon in, kick back and relax to 100% cartoons!',
14151415
title: 'Non-Stop Cartoons!',
14161416
},
1417+
plugins: {
1418+
toLoad: [
1419+
{
1420+
html: 'https://ws-dazzler-web-statics-dev.s3.eu-west-1.amazonaws.com/plugin/DazzlerEdgePlugin.js',
1421+
playerOnly: true,
1422+
data: {
1423+
env: 'test',
1424+
sid: 'cbbc',
1425+
holdingImageURL:
1426+
'https://ichef.bbci.co.uk/images/ic/$recipe/p0k31t4d.jpg',
1427+
uiLanguage: 'es',
1428+
},
1429+
},
1430+
],
1431+
},
14171432
product: 'news',
14181433
statsObject: {
14191434
destination: 'WS_NEWS_LANGUAGES',
@@ -1514,6 +1529,21 @@ describe('buildSettings', () => {
15141529
'جولة إخبارية يومية تتناول أهم الأحداث العربية والعالمية في تقارير ولقاءات وتحليلات ',
15151530
title: 'BBC Arabic TV',
15161531
},
1532+
plugins: {
1533+
toLoad: [
1534+
{
1535+
html: 'https://ws-dazzler-web-statics-dev.s3.eu-west-1.amazonaws.com/plugin/DazzlerEdgePlugin.js',
1536+
playerOnly: true,
1537+
data: {
1538+
env: 'test',
1539+
sid: 'bbc_arabic_tv',
1540+
holdingImageURL:
1541+
'https://ichef.bbci.co.uk/images/ic/$recipe/p08b23t4.png',
1542+
uiLanguage: 'ar',
1543+
},
1544+
},
1545+
],
1546+
},
15171547
product: 'news',
15181548
statsObject: {
15191549
destination: 'WS_NEWS_LANGUAGES',

src/app/components/MediaLoader/utils/buildSettings.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import onClient from '#app/lib/utilities/onClient';
22
import isLive from '#app/lib/utilities/isLive';
33
import filterForBlockType from '#app/lib/utilities/blockHandlers';
4+
import { LIVE_TV_PAGE } from '#app/routes/utils/pageTypes';
45
import { BuildConfigProps, PlayerConfig } from '../types';
56
import configForMediaBlockType from '../configs';
67

@@ -22,6 +23,8 @@ const isTestRequested = () => {
2223
return false;
2324
};
2425

26+
const dazzlerStreamLangs = ['hi'];
27+
2528
const buildSettings = ({
2629
id,
2730
blocks,
@@ -56,7 +59,14 @@ const buildSettings = ({
5659
},
5760
...(!embedded && { superResponsive: true }),
5861
...(counterName && { counterName }),
59-
...(isTestRequested() && { mediator: { host: 'open.test.bbc.co.uk' } }),
62+
...(isTestRequested() && {
63+
mediator: {
64+
host:
65+
dazzlerStreamLangs.includes(lang) && pageType === LIVE_TV_PAGE
66+
? 'open.live.bbc.co.uk'
67+
: 'open.test.bbc.co.uk',
68+
},
69+
}),
6070
statsObject: {
6171
destination: statsDestination,
6272
producer,

ws-nextjs-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
},
4949
"dependencies": {
5050
"next": "16.2.3",
51-
"sharp": "0.34.5"
51+
"sharp": "0.34.5",
52+
"temporal-polyfill": "0.3.0"
5253
}
5354
}

ws-nextjs-app/pages/[service]/watch/[id]/live/LiveTvPageLayout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ChartbeatAnalytics from '#app/components/ChartbeatAnalytics';
1010
import LinkedData from '#app/components/LinkedData';
1111
import { LiveTVPageProps } from './types';
1212
import styles from './styles';
13+
import 'temporal-polyfill/global';
1314

1415
const renderCuration = ({
1516
curation,

yarn.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17599,6 +17599,7 @@ __metadata:
1759917599
npm-run-all2: "npm:8.0.4"
1760017600
sharp: "npm:0.34.5"
1760117601
swc-loader: "npm:0.2.7"
17602+
temporal-polyfill: "npm:0.3.0"
1760217603
ts-node: "npm:10.9.2"
1760317604
languageName: unknown
1760417605
linkType: soft
@@ -18526,6 +18527,22 @@ __metadata:
1852618527
languageName: node
1852718528
linkType: hard
1852818529

18530+
"temporal-polyfill@npm:0.3.0":
18531+
version: 0.3.0
18532+
resolution: "temporal-polyfill@npm:0.3.0"
18533+
dependencies:
18534+
temporal-spec: "npm:0.3.0"
18535+
checksum: 10/e4f5c0e546bf663720569b8b68fc41aa43ea891a77043a5614f6c1f2109cd01fe60c90b9de2f5d4f92f3155bfbdd17ad3ec7de1e9aaf01fa3cf156f230a0e41a
18536+
languageName: node
18537+
linkType: hard
18538+
18539+
"temporal-spec@npm:0.3.0":
18540+
version: 0.3.0
18541+
resolution: "temporal-spec@npm:0.3.0"
18542+
checksum: 10/5863e3e3f364a5cf64bf999c85bf19b08924a91ee8d618489d9bf6cfff2452e4f916080c8ede93fc91de609200fc20002928e0146c7fc15375b123b20234799b
18543+
languageName: node
18544+
linkType: hard
18545+
1852918546
"terser-webpack-plugin@npm:5.3.14, terser-webpack-plugin@npm:^5.3.14":
1853018547
version: 5.3.14
1853118548
resolution: "terser-webpack-plugin@npm:5.3.14"

0 commit comments

Comments
 (0)