bigscreen-player 10.12.2 → 10.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{embeddedsubtitles-a53d1f7e.js → embeddedsubtitles-778e2ed7.js} +3 -2
- package/dist/esm/{imscsubtitles-8515b60a.js → imscsubtitles-2cdb9565.js} +17 -6
- package/dist/esm/{legacysubtitles-2c317da3.js → legacysubtitles-48e37e78.js} +19 -20
- package/dist/esm/{main-18bbfd16.js → main-3b38d339.js} +34 -23
- package/dist/esm/main.js +1 -1
- package/dist/esm/{msestrategy-cc632a55.js → msestrategy-79f90aba.js} +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fromXML, generateISD, renderHTML } from 'smp-imsc';
|
|
2
|
-
import { U as Utils, a as DebugTool, P as Plugins, D as DOMHelpers } from './main-
|
|
2
|
+
import { U as Utils, a as DebugTool, P as Plugins, D as DOMHelpers } from './main-3b38d339.js';
|
|
3
3
|
import 'tslib';
|
|
4
4
|
|
|
5
|
-
function EmbeddedSubtitles(mediaPlayer,
|
|
5
|
+
function EmbeddedSubtitles(mediaPlayer, parentElement, { autoStart = false, defaultStyleOpts = {} } = {}) {
|
|
6
6
|
let exampleSubtitlesElement;
|
|
7
7
|
let imscRenderOpts = transformStyleOptions(defaultStyleOpts);
|
|
8
8
|
let subtitlesEnabled = false;
|
|
@@ -41,6 +41,7 @@ function EmbeddedSubtitles(mediaPlayer, autoStart, parentElement, _mediaSources,
|
|
|
41
41
|
exampleSubtitlesElement.style.right = `${rightPixels}px`;
|
|
42
42
|
exampleSubtitlesElement.style.bottom = `${bottomPixels}px`;
|
|
43
43
|
exampleSubtitlesElement.style.left = `${leftPixels}px`;
|
|
44
|
+
|
|
44
45
|
parentElement.appendChild(exampleSubtitlesElement);
|
|
45
46
|
|
|
46
47
|
renderSubtitle(exampleXml, 1, exampleSubtitlesElement, exampleStyle, renderHeight, renderWidth);
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { fromXML, generateISD, renderHTML } from 'smp-imsc';
|
|
2
|
-
import { f as findSegmentTemplate, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-
|
|
2
|
+
import { f as findSegmentTemplate, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-3b38d339.js';
|
|
3
3
|
import 'tslib';
|
|
4
4
|
|
|
5
5
|
const SEGMENTS_BUFFER_SIZE = 3;
|
|
6
6
|
const LOAD_ERROR_COUNT_MAX = 3;
|
|
7
7
|
|
|
8
|
-
function IMSCSubtitles(
|
|
8
|
+
function IMSCSubtitles(
|
|
9
|
+
mediaPlayer,
|
|
10
|
+
parentElement,
|
|
11
|
+
mediaSources,
|
|
12
|
+
{ alwaysOnTop = false, autoStart = false, defaultStyleOpts = {} } = {}
|
|
13
|
+
) {
|
|
9
14
|
let imscRenderOpts = transformStyleOptions(defaultStyleOpts);
|
|
10
15
|
let currentSegmentRendered = {};
|
|
11
16
|
let loadErrorCount = 0;
|
|
@@ -15,9 +20,7 @@ function IMSCSubtitles(mediaPlayer, autoStart, parentElement, mediaSources, defa
|
|
|
15
20
|
let currentSubtitlesElement;
|
|
16
21
|
let updateInterval;
|
|
17
22
|
|
|
18
|
-
if (autoStart)
|
|
19
|
-
start();
|
|
20
|
-
}
|
|
23
|
+
if (autoStart) start();
|
|
21
24
|
|
|
22
25
|
function hasOffset() {
|
|
23
26
|
const { presentationTimeOffsetInMilliseconds } = mediaSources.time();
|
|
@@ -172,7 +175,9 @@ function IMSCSubtitles(mediaPlayer, autoStart, parentElement, mediaSources, defa
|
|
|
172
175
|
|
|
173
176
|
// Opts: { backgroundColour: string (css colour, hex), fontFamily: string , size: number, lineHeight: number }
|
|
174
177
|
function transformStyleOptions(opts) {
|
|
175
|
-
if (opts === undefined)
|
|
178
|
+
if (opts === undefined || Object.keys(opts).length === 0) {
|
|
179
|
+
return {}
|
|
180
|
+
}
|
|
176
181
|
|
|
177
182
|
const customStyles = {};
|
|
178
183
|
|
|
@@ -239,6 +244,9 @@ function IMSCSubtitles(mediaPlayer, autoStart, parentElement, mediaSources, defa
|
|
|
239
244
|
currentSubtitlesElement = document.createElement("div");
|
|
240
245
|
currentSubtitlesElement.id = "bsp_subtitles";
|
|
241
246
|
currentSubtitlesElement.style.position = "absolute";
|
|
247
|
+
|
|
248
|
+
if (alwaysOnTop) currentSubtitlesElement.style.zIndex = 2147483647;
|
|
249
|
+
|
|
242
250
|
parentElement.appendChild(currentSubtitlesElement);
|
|
243
251
|
|
|
244
252
|
renderSubtitle(
|
|
@@ -276,6 +284,9 @@ function IMSCSubtitles(mediaPlayer, autoStart, parentElement, mediaSources, defa
|
|
|
276
284
|
exampleSubtitlesElement.style.right = `${rightPixels}px`;
|
|
277
285
|
exampleSubtitlesElement.style.bottom = `${bottomPixels}px`;
|
|
278
286
|
exampleSubtitlesElement.style.left = `${leftPixels}px`;
|
|
287
|
+
|
|
288
|
+
if (alwaysOnTop) exampleSubtitlesElement.style.zIndex = 2147483647;
|
|
289
|
+
|
|
279
290
|
parentElement.appendChild(exampleSubtitlesElement);
|
|
280
291
|
|
|
281
292
|
renderSubtitle(exampleXml, 1, exampleSubtitlesElement, exampleStyle, renderHeight, renderWidth);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-
|
|
1
|
+
import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-3b38d339.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -258,16 +258,14 @@ function Transformer() {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
function Renderer(id, captionsXML, mediaPlayer) {
|
|
261
|
-
|
|
261
|
+
const outputElement = document.createElement("div");
|
|
262
|
+
const transformedSubtitles = Transformer().transformXML(captionsXML);
|
|
263
|
+
|
|
262
264
|
let liveItems = [];
|
|
263
265
|
let interval = 0;
|
|
264
|
-
let outputElement;
|
|
265
266
|
|
|
266
|
-
outputElement = document.createElement("div");
|
|
267
267
|
outputElement.id = id;
|
|
268
268
|
|
|
269
|
-
transformedSubtitles = Transformer().transformXML(captionsXML);
|
|
270
|
-
|
|
271
269
|
start();
|
|
272
270
|
|
|
273
271
|
function render() {
|
|
@@ -304,8 +302,8 @@ function Renderer(id, captionsXML, mediaPlayer) {
|
|
|
304
302
|
updateCaptions(time);
|
|
305
303
|
|
|
306
304
|
confirmCaptionsRendered();
|
|
307
|
-
} catch (
|
|
308
|
-
DebugTool.info(
|
|
305
|
+
} catch (error) {
|
|
306
|
+
DebugTool.info(`Exception while rendering subtitles: ${error}`);
|
|
309
307
|
Plugins.interface.onSubtitlesRenderError();
|
|
310
308
|
}
|
|
311
309
|
}
|
|
@@ -322,32 +320,31 @@ function Renderer(id, captionsXML, mediaPlayer) {
|
|
|
322
320
|
}
|
|
323
321
|
|
|
324
322
|
function cleanOldCaptions(time) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
live.splice(i, 1);
|
|
323
|
+
for (let idx = liveItems.length - 1; idx >= 0; idx--) {
|
|
324
|
+
if (liveItems[idx].removeFromDomIfExpired(time)) {
|
|
325
|
+
liveItems.splice(idx, 1);
|
|
329
326
|
}
|
|
330
327
|
}
|
|
331
328
|
}
|
|
332
329
|
|
|
333
330
|
function addNewCaptions(time) {
|
|
334
|
-
const live = liveItems;
|
|
335
331
|
const fresh = transformedSubtitles.subtitlesForTime(time);
|
|
336
|
-
liveItems =
|
|
337
|
-
|
|
332
|
+
liveItems = [...liveItems, ...fresh];
|
|
333
|
+
|
|
334
|
+
for (let idx = 0; idx < fresh.length; idx++) {
|
|
338
335
|
// TODO: Probably start adding to the DOM here rather than calling through.
|
|
339
|
-
fresh[
|
|
336
|
+
fresh[idx].addToDom(outputElement);
|
|
340
337
|
}
|
|
341
338
|
}
|
|
342
339
|
|
|
343
340
|
return {
|
|
344
|
-
render
|
|
345
|
-
start
|
|
346
|
-
stop
|
|
341
|
+
render,
|
|
342
|
+
start,
|
|
343
|
+
stop,
|
|
347
344
|
}
|
|
348
345
|
}
|
|
349
346
|
|
|
350
|
-
function LegacySubtitles(mediaPlayer,
|
|
347
|
+
function LegacySubtitles(mediaPlayer, parentElement, mediaSources, { alwaysOnTop = false, autoStart = false } = {}) {
|
|
351
348
|
const container = document.createElement("div");
|
|
352
349
|
let subtitlesRenderer;
|
|
353
350
|
|
|
@@ -414,6 +411,8 @@ function LegacySubtitles(mediaPlayer, autoStart, parentElement, mediaSources) {
|
|
|
414
411
|
container.style.paddingBottom = "40px";
|
|
415
412
|
}
|
|
416
413
|
|
|
414
|
+
if (alwaysOnTop) container.style.zIndex = 2147483647;
|
|
415
|
+
|
|
417
416
|
// TODO: We don't need this extra Div really... can we get rid of render() and use the passed in container?
|
|
418
417
|
subtitlesRenderer = Renderer("playerCaptions", xml, mediaPlayer);
|
|
419
418
|
container.appendChild(subtitlesRenderer.render());
|
|
@@ -5710,7 +5710,7 @@ BasicStrategy.getLiveSupport = () => LiveSupport.SEEKABLE;
|
|
|
5710
5710
|
function StrategyPicker() {
|
|
5711
5711
|
return new Promise((resolve, reject) => {
|
|
5712
5712
|
if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.MSE) {
|
|
5713
|
-
return import('./msestrategy-
|
|
5713
|
+
return import('./msestrategy-79f90aba.js')
|
|
5714
5714
|
.then(({ default: MSEStrategy }) => resolve(MSEStrategy))
|
|
5715
5715
|
.catch((reason) => {
|
|
5716
5716
|
const error = new Error(isError(reason) ? reason.message : undefined);
|
|
@@ -6508,7 +6508,7 @@ const PauseTriggers = {
|
|
|
6508
6508
|
DEVICE: 3,
|
|
6509
6509
|
};
|
|
6510
6510
|
|
|
6511
|
-
var Version = "10.
|
|
6511
|
+
var Version = "10.13.0";
|
|
6512
6512
|
|
|
6513
6513
|
/* eslint-disable no-use-before-define */
|
|
6514
6514
|
|
|
@@ -7682,7 +7682,13 @@ function findSegmentTemplate(url) {
|
|
|
7682
7682
|
return matches[matches.length - 1];
|
|
7683
7683
|
}
|
|
7684
7684
|
|
|
7685
|
-
function Subtitles(
|
|
7685
|
+
function Subtitles(
|
|
7686
|
+
mediaPlayer,
|
|
7687
|
+
playbackElement,
|
|
7688
|
+
mediaSources,
|
|
7689
|
+
callback,
|
|
7690
|
+
{ alwaysOnTop, autoStart, defaultStyleOpts } = {}
|
|
7691
|
+
) {
|
|
7686
7692
|
const useLegacySubs = window.bigscreenPlayer?.overrides?.legacySubtitles ?? false;
|
|
7687
7693
|
const embeddedSubs = window.bigscreenPlayer?.overrides?.embeddedSubtitles ?? false;
|
|
7688
7694
|
|
|
@@ -7694,33 +7700,41 @@ function Subtitles(mediaPlayer, autoStart, playbackElement, defaultStyleOpts, me
|
|
|
7694
7700
|
|
|
7695
7701
|
if (available()) {
|
|
7696
7702
|
if (useLegacySubs) {
|
|
7697
|
-
import('./legacysubtitles-
|
|
7703
|
+
import('./legacysubtitles-48e37e78.js')
|
|
7698
7704
|
.then(({ default: LegacySubtitles }) => {
|
|
7699
|
-
subtitlesContainer = LegacySubtitles(mediaPlayer,
|
|
7705
|
+
subtitlesContainer = LegacySubtitles(mediaPlayer, playbackElement, mediaSources, {
|
|
7706
|
+
alwaysOnTop,
|
|
7707
|
+
autoStart,
|
|
7708
|
+
defaultStyleOpts,
|
|
7709
|
+
});
|
|
7710
|
+
|
|
7700
7711
|
callback(subtitlesEnabled);
|
|
7701
7712
|
})
|
|
7702
7713
|
.catch(() => {
|
|
7703
7714
|
Plugins.interface.onSubtitlesDynamicLoadError();
|
|
7704
7715
|
});
|
|
7705
7716
|
} else if (embeddedSubs) {
|
|
7706
|
-
import('./embeddedsubtitles-
|
|
7717
|
+
import('./embeddedsubtitles-778e2ed7.js')
|
|
7707
7718
|
.then(({ default: EmbeddedSubtitles }) => {
|
|
7708
|
-
subtitlesContainer = EmbeddedSubtitles(
|
|
7709
|
-
mediaPlayer,
|
|
7719
|
+
subtitlesContainer = EmbeddedSubtitles(mediaPlayer, playbackElement, {
|
|
7710
7720
|
autoStart,
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
);
|
|
7721
|
+
defaultStyleOpts,
|
|
7722
|
+
});
|
|
7723
|
+
|
|
7715
7724
|
callback(subtitlesEnabled);
|
|
7716
7725
|
})
|
|
7717
7726
|
.catch(() => {
|
|
7718
7727
|
Plugins.interface.onSubtitlesDynamicLoadError();
|
|
7719
7728
|
});
|
|
7720
7729
|
} else {
|
|
7721
|
-
import('./imscsubtitles-
|
|
7730
|
+
import('./imscsubtitles-2cdb9565.js')
|
|
7722
7731
|
.then(({ default: IMSCSubtitles }) => {
|
|
7723
|
-
subtitlesContainer = IMSCSubtitles(mediaPlayer,
|
|
7732
|
+
subtitlesContainer = IMSCSubtitles(mediaPlayer, playbackElement, mediaSources, {
|
|
7733
|
+
alwaysOnTop,
|
|
7734
|
+
autoStart,
|
|
7735
|
+
defaultStyleOpts,
|
|
7736
|
+
});
|
|
7737
|
+
|
|
7724
7738
|
callback(subtitlesEnabled);
|
|
7725
7739
|
})
|
|
7726
7740
|
.catch(() => {
|
|
@@ -7929,7 +7943,7 @@ function BigscreenPlayer() {
|
|
|
7929
7943
|
}
|
|
7930
7944
|
}
|
|
7931
7945
|
|
|
7932
|
-
function bigscreenPlayerDataLoaded({ media, enableSubtitles, enableAudioDescribed }) {
|
|
7946
|
+
function bigscreenPlayerDataLoaded({ media, enableSubtitles, subtitlesAlwaysOnTop, enableAudioDescribed }) {
|
|
7933
7947
|
abortSignal.throwIfAborted(AbortStages.DATA_LOADED);
|
|
7934
7948
|
|
|
7935
7949
|
const initialPresentationTime =
|
|
@@ -7956,14 +7970,11 @@ function BigscreenPlayer() {
|
|
|
7956
7970
|
PlayerComponent.getLiveSupport(),
|
|
7957
7971
|
() => {
|
|
7958
7972
|
_callbacks.playerReady && _callbacks.playerReady();
|
|
7959
|
-
subtitles = Subtitles(
|
|
7960
|
-
|
|
7961
|
-
enableSubtitles,
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
mediaSources,
|
|
7965
|
-
callSubtitlesCallbacks
|
|
7966
|
-
);
|
|
7973
|
+
subtitles = Subtitles(playerComponent, playbackElement, mediaSources, callSubtitlesCallbacks, {
|
|
7974
|
+
alwaysOnTop: subtitlesAlwaysOnTop,
|
|
7975
|
+
autoStart: enableSubtitles,
|
|
7976
|
+
defaultStyleOpts: media.subtitleCustomisation,
|
|
7977
|
+
});
|
|
7967
7978
|
}
|
|
7968
7979
|
);
|
|
7969
7980
|
}
|
package/dist/esm/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, b as LiveSupport, c as ManifestType, M as MediaKinds, d as MediaState, g as MockBigscreenPlayer, h as PauseTriggers, i as PlaybackStrategy, k as Timeline, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, l as isMessage, m as isMetric, n as isTrace } from './main-
|
|
1
|
+
export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, b as LiveSupport, c as ManifestType, M as MediaKinds, d as MediaState, g as MockBigscreenPlayer, h as PauseTriggers, i as PlaybackStrategy, k as Timeline, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, l as isMessage, m as isMetric, n as isTrace } from './main-3b38d339.js';
|
|
2
2
|
import 'tslib';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MediaPlayer } from 'dashjs/index';
|
|
2
|
-
import { U as Utils, M as MediaKinds, b as LiveSupport, a as DebugTool, c as ManifestType, P as Plugins, d as MediaState, e as autoResumeAtStartOfRange, D as DOMHelpers } from './main-
|
|
2
|
+
import { U as Utils, M as MediaKinds, b as LiveSupport, a as DebugTool, c as ManifestType, P as Plugins, d as MediaState, e as autoResumeAtStartOfRange, D as DOMHelpers } from './main-3b38d339.js';
|
|
3
3
|
import 'tslib';
|
|
4
4
|
|
|
5
5
|
function filter(manifest, representationOptions) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigscreen-player",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Simplified media playback for bigscreen devices.",
|
|
6
6
|
"main": "dist/esm/main.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"typescript-eslint": "^7.2.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"dashjs": "github:bbc/dash.js#smp-v4.7.3-
|
|
67
|
+
"dashjs": "github:bbc/dash.js#smp-v4.7.3-14",
|
|
68
68
|
"smp-imsc": "github:bbc/imscJS#v1.0.3"
|
|
69
69
|
},
|
|
70
70
|
"repository": {
|