bigscreen-player 10.12.3 → 10.14.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-04b776a6.js → embeddedsubtitles-236add87.js} +3 -2
- package/dist/esm/{imscsubtitles-b5d025c8.js → imscsubtitles-bce3be31.js} +17 -6
- package/dist/esm/{legacysubtitles-11a20eb4.js → legacysubtitles-7ffcf645.js} +19 -20
- package/dist/esm/{main-9fb52303.js → main-549c287c.js} +37 -25
- package/dist/esm/main.js +1 -1
- package/dist/esm/{msestrategy-80c734fe.js → msestrategy-8433ea6e.js} +18 -2
- package/package.json +1 -1
|
@@ -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-549c287c.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-549c287c.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-549c287c.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-8433ea6e.js')
|
|
5714
5714
|
.then(({ default: MSEStrategy }) => resolve(MSEStrategy))
|
|
5715
5715
|
.catch((reason) => {
|
|
5716
5716
|
const error = new Error(isError(reason) ? reason.message : undefined);
|
|
@@ -6085,7 +6085,8 @@ function PlayerComponent(
|
|
|
6085
6085
|
{
|
|
6086
6086
|
enable: bigscreenPlayerData.enableAudioDescribed,
|
|
6087
6087
|
callback: audioDescribedCallback,
|
|
6088
|
-
}
|
|
6088
|
+
},
|
|
6089
|
+
bigscreenPlayerData?.debug
|
|
6089
6090
|
);
|
|
6090
6091
|
|
|
6091
6092
|
playbackStrategy.addEventCallback(this, eventCallback);
|
|
@@ -6508,7 +6509,7 @@ const PauseTriggers = {
|
|
|
6508
6509
|
DEVICE: 3,
|
|
6509
6510
|
};
|
|
6510
6511
|
|
|
6511
|
-
var Version = "10.
|
|
6512
|
+
var Version = "10.14.0";
|
|
6512
6513
|
|
|
6513
6514
|
/* eslint-disable no-use-before-define */
|
|
6514
6515
|
|
|
@@ -7682,7 +7683,13 @@ function findSegmentTemplate(url) {
|
|
|
7682
7683
|
return matches[matches.length - 1];
|
|
7683
7684
|
}
|
|
7684
7685
|
|
|
7685
|
-
function Subtitles(
|
|
7686
|
+
function Subtitles(
|
|
7687
|
+
mediaPlayer,
|
|
7688
|
+
playbackElement,
|
|
7689
|
+
mediaSources,
|
|
7690
|
+
callback,
|
|
7691
|
+
{ alwaysOnTop, autoStart, defaultStyleOpts } = {}
|
|
7692
|
+
) {
|
|
7686
7693
|
const useLegacySubs = window.bigscreenPlayer?.overrides?.legacySubtitles ?? false;
|
|
7687
7694
|
const embeddedSubs = window.bigscreenPlayer?.overrides?.embeddedSubtitles ?? false;
|
|
7688
7695
|
|
|
@@ -7694,33 +7701,41 @@ function Subtitles(mediaPlayer, autoStart, playbackElement, defaultStyleOpts, me
|
|
|
7694
7701
|
|
|
7695
7702
|
if (available()) {
|
|
7696
7703
|
if (useLegacySubs) {
|
|
7697
|
-
import('./legacysubtitles-
|
|
7704
|
+
import('./legacysubtitles-7ffcf645.js')
|
|
7698
7705
|
.then(({ default: LegacySubtitles }) => {
|
|
7699
|
-
subtitlesContainer = LegacySubtitles(mediaPlayer,
|
|
7706
|
+
subtitlesContainer = LegacySubtitles(mediaPlayer, playbackElement, mediaSources, {
|
|
7707
|
+
alwaysOnTop,
|
|
7708
|
+
autoStart,
|
|
7709
|
+
defaultStyleOpts,
|
|
7710
|
+
});
|
|
7711
|
+
|
|
7700
7712
|
callback(subtitlesEnabled);
|
|
7701
7713
|
})
|
|
7702
7714
|
.catch(() => {
|
|
7703
7715
|
Plugins.interface.onSubtitlesDynamicLoadError();
|
|
7704
7716
|
});
|
|
7705
7717
|
} else if (embeddedSubs) {
|
|
7706
|
-
import('./embeddedsubtitles-
|
|
7718
|
+
import('./embeddedsubtitles-236add87.js')
|
|
7707
7719
|
.then(({ default: EmbeddedSubtitles }) => {
|
|
7708
|
-
subtitlesContainer = EmbeddedSubtitles(
|
|
7709
|
-
mediaPlayer,
|
|
7720
|
+
subtitlesContainer = EmbeddedSubtitles(mediaPlayer, playbackElement, {
|
|
7710
7721
|
autoStart,
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
);
|
|
7722
|
+
defaultStyleOpts,
|
|
7723
|
+
});
|
|
7724
|
+
|
|
7715
7725
|
callback(subtitlesEnabled);
|
|
7716
7726
|
})
|
|
7717
7727
|
.catch(() => {
|
|
7718
7728
|
Plugins.interface.onSubtitlesDynamicLoadError();
|
|
7719
7729
|
});
|
|
7720
7730
|
} else {
|
|
7721
|
-
import('./imscsubtitles-
|
|
7731
|
+
import('./imscsubtitles-bce3be31.js')
|
|
7722
7732
|
.then(({ default: IMSCSubtitles }) => {
|
|
7723
|
-
subtitlesContainer = IMSCSubtitles(mediaPlayer,
|
|
7733
|
+
subtitlesContainer = IMSCSubtitles(mediaPlayer, playbackElement, mediaSources, {
|
|
7734
|
+
alwaysOnTop,
|
|
7735
|
+
autoStart,
|
|
7736
|
+
defaultStyleOpts,
|
|
7737
|
+
});
|
|
7738
|
+
|
|
7724
7739
|
callback(subtitlesEnabled);
|
|
7725
7740
|
})
|
|
7726
7741
|
.catch(() => {
|
|
@@ -7929,7 +7944,7 @@ function BigscreenPlayer() {
|
|
|
7929
7944
|
}
|
|
7930
7945
|
}
|
|
7931
7946
|
|
|
7932
|
-
function bigscreenPlayerDataLoaded({ media, enableSubtitles, enableAudioDescribed }) {
|
|
7947
|
+
function bigscreenPlayerDataLoaded({ media, enableSubtitles, subtitlesAlwaysOnTop, enableAudioDescribed, debug }) {
|
|
7933
7948
|
abortSignal.throwIfAborted(AbortStages.DATA_LOADED);
|
|
7934
7949
|
|
|
7935
7950
|
const initialPresentationTime =
|
|
@@ -7942,7 +7957,7 @@ function BigscreenPlayer() {
|
|
|
7942
7957
|
|
|
7943
7958
|
playerComponent = PlayerComponent(
|
|
7944
7959
|
playbackElement,
|
|
7945
|
-
{ media, enableAudioDescribed, initialPlaybackTime: initialPresentationTime },
|
|
7960
|
+
{ media, enableAudioDescribed, initialPlaybackTime: initialPresentationTime, debug },
|
|
7946
7961
|
mediaSources,
|
|
7947
7962
|
mediaStateUpdateCallback,
|
|
7948
7963
|
_callbacks.playerError,
|
|
@@ -7956,14 +7971,11 @@ function BigscreenPlayer() {
|
|
|
7956
7971
|
PlayerComponent.getLiveSupport(),
|
|
7957
7972
|
() => {
|
|
7958
7973
|
_callbacks.playerReady && _callbacks.playerReady();
|
|
7959
|
-
subtitles = Subtitles(
|
|
7960
|
-
|
|
7961
|
-
enableSubtitles,
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
mediaSources,
|
|
7965
|
-
callSubtitlesCallbacks
|
|
7966
|
-
);
|
|
7974
|
+
subtitles = Subtitles(playerComponent, playbackElement, mediaSources, callSubtitlesCallbacks, {
|
|
7975
|
+
alwaysOnTop: subtitlesAlwaysOnTop,
|
|
7976
|
+
autoStart: enableSubtitles,
|
|
7977
|
+
defaultStyleOpts: media.subtitleCustomisation,
|
|
7978
|
+
});
|
|
7967
7979
|
}
|
|
7968
7980
|
);
|
|
7969
7981
|
}
|
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-549c287c.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-549c287c.js';
|
|
3
3
|
import 'tslib';
|
|
4
4
|
|
|
5
5
|
function filter(manifest, representationOptions) {
|
|
@@ -130,7 +130,8 @@ function MSEStrategy(
|
|
|
130
130
|
playbackElement,
|
|
131
131
|
_isUHD = false,
|
|
132
132
|
customPlayerSettings = {},
|
|
133
|
-
audioDescribedOpts = {}
|
|
133
|
+
audioDescribedOpts = {},
|
|
134
|
+
debugSettings = {}
|
|
134
135
|
) {
|
|
135
136
|
const audioDescribed = { callback: undefined, enable: false, ...audioDescribedOpts };
|
|
136
137
|
|
|
@@ -222,6 +223,7 @@ function MSEStrategy(
|
|
|
222
223
|
METRIC_CHANGED: "metricChanged",
|
|
223
224
|
STREAM_INITIALIZED: "streamInitialized",
|
|
224
225
|
FRAGMENT_CONTENT_LENGTH_MISMATCH: "fragmentContentLengthMismatch",
|
|
226
|
+
FRAGMENT_LOADED: "fragmentLoadingCompleted",
|
|
225
227
|
QUOTA_EXCEEDED: "quotaExceeded",
|
|
226
228
|
TEXT_TRACKS_ADDED: "allTextTracksAdded",
|
|
227
229
|
CURRENT_TRACK_CHANGED: "currentTrackChanged",
|
|
@@ -632,6 +634,19 @@ function MSEStrategy(
|
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
636
|
|
|
637
|
+
function onFragmentLoaded() {
|
|
638
|
+
if (debugSettings?.fragmentResponseHeaders) {
|
|
639
|
+
debugSettings.fragmentResponseHeaders.forEach((responseHeader) => {
|
|
640
|
+
const responseHeaderValue = mediaPlayer
|
|
641
|
+
.getDashMetrics()
|
|
642
|
+
.getLatestFragmentRequestHeaderValueByID("video", responseHeader);
|
|
643
|
+
if (responseHeaderValue) {
|
|
644
|
+
DebugTool.staticMetric(responseHeader.toLowerCase(), responseHeaderValue);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
635
650
|
function onFragmentContentLengthMismatch(event) {
|
|
636
651
|
DebugTool.info(`Fragment Content Length Mismatch: ${event.responseUrl} (${event.mediaType})`);
|
|
637
652
|
DebugTool.info(`Header Length ${event.headerLength}`);
|
|
@@ -813,6 +828,7 @@ function MSEStrategy(
|
|
|
813
828
|
mediaPlayer.on(DashJSEvents.SERVICE_LOCATION_AVAILABLE, onServiceLocationAvailable);
|
|
814
829
|
mediaPlayer.on(DashJSEvents.URL_RESOLUTION_FAILED, onURLResolutionFailed);
|
|
815
830
|
mediaPlayer.on(DashJSEvents.FRAGMENT_CONTENT_LENGTH_MISMATCH, onFragmentContentLengthMismatch);
|
|
831
|
+
mediaPlayer.on(DashJSEvents.FRAGMENT_LOADED, onFragmentLoaded);
|
|
816
832
|
mediaPlayer.on(DashJSEvents.GAP_JUMP, onGapJump);
|
|
817
833
|
mediaPlayer.on(DashJSEvents.GAP_JUMP_TO_END, onGapJump);
|
|
818
834
|
mediaPlayer.on(DashJSEvents.QUOTA_EXCEEDED, onQuotaExceeded);
|