@xibosignage/xibo-layout-renderer 1.0.26 → 1.0.27
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/src/Modules/Media/Media.d.ts +4 -0
- package/dist/src/Types/Media/Media.types.d.ts +3 -0
- package/dist/src/Types/Region/Region.types.d.ts +1 -0
- package/dist/src/Types/XLR/XLR.types.d.ts +3 -0
- package/dist/xibo-layout-renderer.cjs.js +77 -15
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +10 -0
- package/dist/xibo-layout-renderer.esm.js +77 -15
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +77 -15
- package/dist/xibo-layout-renderer.min.js +7 -7
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -755,6 +755,7 @@ var XiboLayoutRenderer = (function (exports) {
|
|
|
755
755
|
options: {},
|
|
756
756
|
playNextMedia: function playNextMedia() {},
|
|
757
757
|
playPreviousMedia: function playPreviousMedia() {},
|
|
758
|
+
prepareMedia: function prepareMedia(_media) {},
|
|
758
759
|
prepareMediaObjects: function prepareMediaObjects() {},
|
|
759
760
|
prepareRegion: function prepareRegion() {},
|
|
760
761
|
ready: false,
|
|
@@ -73985,6 +73986,9 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73985
73986
|
_defineProperty(this, "xml", null);
|
|
73986
73987
|
_defineProperty(this, "videoHandler", void 0);
|
|
73987
73988
|
_defineProperty(this, "mediaTimer", void 0);
|
|
73989
|
+
_defineProperty(this, "sspImpressionUrls", undefined);
|
|
73990
|
+
_defineProperty(this, "sspErrorUrls", undefined);
|
|
73991
|
+
_defineProperty(this, "isSspWidget", false);
|
|
73988
73992
|
_defineProperty(this, "mediaTimeCount", 0);
|
|
73989
73993
|
_defineProperty(this, "xlr", {});
|
|
73990
73994
|
_defineProperty(this, "statsBC", new BroadcastChannel('statsBC'));
|
|
@@ -74070,6 +74074,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74070
74074
|
layoutId: media.region.layout.id
|
|
74071
74075
|
});
|
|
74072
74076
|
_this.xlr.emitter.emit('widgetEnd', parseInt(media.id));
|
|
74077
|
+
if (_this.isSspWidget) {
|
|
74078
|
+
var _this$sspImpressionUr, _this$sspErrorUrls;
|
|
74079
|
+
_this.xlr.emitter.emit('sspWidgetEnd', (_this$sspImpressionUr = _this.sspImpressionUrls) !== null && _this$sspImpressionUr !== void 0 ? _this$sspImpressionUr : [], (_this$sspErrorUrls = _this.sspErrorUrls) !== null && _this$sspErrorUrls !== void 0 ? _this$sspErrorUrls : [], _this.sspImpressionUrls ? _this.duration : 0);
|
|
74080
|
+
}
|
|
74073
74081
|
media.region.playNextMedia();
|
|
74074
74082
|
});
|
|
74075
74083
|
this.on('cancelled', function (media) {
|
|
@@ -74096,6 +74104,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74096
74104
|
layoutId: media.region.layout.id
|
|
74097
74105
|
});
|
|
74098
74106
|
_this.xlr.emitter.emit('widgetEnd', parseInt(media.id));
|
|
74107
|
+
if (_this.isSspWidget) {
|
|
74108
|
+
var _this$sspImpressionUr2, _this$sspErrorUrls2;
|
|
74109
|
+
_this.xlr.emitter.emit('sspWidgetEnd', (_this$sspImpressionUr2 = _this.sspImpressionUrls) !== null && _this$sspImpressionUr2 !== void 0 ? _this$sspImpressionUr2 : [], (_this$sspErrorUrls2 = _this.sspErrorUrls) !== null && _this$sspErrorUrls2 !== void 0 ? _this$sspErrorUrls2 : [], _this.sspImpressionUrls ? _this.duration : 0);
|
|
74110
|
+
}
|
|
74099
74111
|
media.region.playNextMedia();
|
|
74100
74112
|
});
|
|
74101
74113
|
// Initialize Media object
|
|
@@ -74196,26 +74208,33 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74196
74208
|
if (this.mediaType === 'image' || this.mediaType === 'video') {
|
|
74197
74209
|
resourceUrlParams.mediaType = this.mediaType;
|
|
74198
74210
|
}
|
|
74199
|
-
|
|
74200
|
-
|
|
74201
|
-
|
|
74202
|
-
|
|
74203
|
-
|
|
74204
|
-
|
|
74205
|
-
|
|
74211
|
+
// SSP widget: URL is not known until the consumer resolves an ad at play-time.
|
|
74212
|
+
// Skip all URL composition and leave url as null.
|
|
74213
|
+
if (this.mediaType === 'ssp') {
|
|
74214
|
+
this.url = null;
|
|
74215
|
+
this.isSspWidget = true;
|
|
74216
|
+
} else {
|
|
74217
|
+
var tmpUrl = '';
|
|
74218
|
+
if (this.xlr.config.platform === exports.ConsumerPlatform.CMS) {
|
|
74219
|
+
tmpUrl = composeResourceUrlByPlatform(this.xlr.config, resourceUrlParams);
|
|
74220
|
+
} else if (this.xlr.config.platform === exports.ConsumerPlatform.CHROMEOS) {
|
|
74221
|
+
tmpUrl = composeResourceUrl(this.xlr.config, resourceUrlParams);
|
|
74222
|
+
if (this.mediaType === 'image' || this.mediaType === 'video' || this.mediaType === 'audio') {
|
|
74223
|
+
tmpUrl = composeMediaUrl(resourceUrlParams);
|
|
74224
|
+
// this is an SSP Layout
|
|
74225
|
+
if (this.region.layout.layoutId === -1) {
|
|
74226
|
+
tmpUrl = this.uri;
|
|
74227
|
+
}
|
|
74228
|
+
}
|
|
74229
|
+
} else if (this.xlr.config.platform === exports.ConsumerPlatform.ELECTRON) {
|
|
74230
|
+
tmpUrl = composeResourceUrlByPlatform(this.xlr.config, resourceUrlParams);
|
|
74206
74231
|
// this is an SSP Layout
|
|
74207
74232
|
if (this.region.layout.layoutId === -1) {
|
|
74208
74233
|
tmpUrl = this.uri;
|
|
74209
74234
|
}
|
|
74210
74235
|
}
|
|
74211
|
-
|
|
74212
|
-
tmpUrl = composeResourceUrlByPlatform(this.xlr.config, resourceUrlParams);
|
|
74213
|
-
// this is an SSP Layout
|
|
74214
|
-
if (this.region.layout.layoutId === -1) {
|
|
74215
|
-
tmpUrl = this.uri;
|
|
74216
|
-
}
|
|
74236
|
+
this.url = tmpUrl;
|
|
74217
74237
|
}
|
|
74218
|
-
this.url = tmpUrl;
|
|
74219
74238
|
// Loop if media has loop, or if region has loop and a single media
|
|
74220
74239
|
this.loop = this.options['loop'] == '1' || this.region.options['loop'] == '1' && this.region.totalMediaObjects == 1;
|
|
74221
74240
|
this.html = createMediaElement(this);
|
|
@@ -74332,8 +74351,39 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74332
74351
|
}
|
|
74333
74352
|
return null;
|
|
74334
74353
|
};
|
|
74354
|
+
// SSP widget: if the consumer did not resolve an ad during the preload window
|
|
74355
|
+
// (i.e. setSspAdUrl was never called), skip this widget and advance normally.
|
|
74356
|
+
if (this.mediaType === 'ssp') {
|
|
74357
|
+
console.debug('??? XLR.debug >> Media.run() > SSP widget: no ad resolved during preload, skipping');
|
|
74358
|
+
this.emitter.emit('end', this);
|
|
74359
|
+
return;
|
|
74360
|
+
}
|
|
74335
74361
|
showCurrentMedia();
|
|
74336
74362
|
}
|
|
74363
|
+
}, {
|
|
74364
|
+
key: "setSspAdUrl",
|
|
74365
|
+
value: function setSspAdUrl(url, adMediaType, impressionUrls, errorUrls) {
|
|
74366
|
+
// Ignore if the media has already been skipped or cancelled before the ad arrived.
|
|
74367
|
+
if (this.state !== MediaState.IDLE) {
|
|
74368
|
+
console.debug('??? XLR.debug >> Media::setSspAdUrl - ignoring, media is no longer idle', {
|
|
74369
|
+
state: this.state
|
|
74370
|
+
});
|
|
74371
|
+
return;
|
|
74372
|
+
}
|
|
74373
|
+
// Remove the placeholder <div> so the correct element type can take its place.
|
|
74374
|
+
if (this.html) {
|
|
74375
|
+
this.html.remove();
|
|
74376
|
+
this.html = null;
|
|
74377
|
+
}
|
|
74378
|
+
this.url = url;
|
|
74379
|
+
this.mediaType = adMediaType;
|
|
74380
|
+
this.sspImpressionUrls = impressionUrls;
|
|
74381
|
+
this.sspErrorUrls = errorUrls;
|
|
74382
|
+
// Re-create the element now that mediaType is known, then prepare and append to region DOM.
|
|
74383
|
+
// Visibility and playback are handled by run() when this media's turn comes.
|
|
74384
|
+
this.html = createMediaElement(this);
|
|
74385
|
+
this.region.prepareMedia(this);
|
|
74386
|
+
}
|
|
74337
74387
|
}, {
|
|
74338
74388
|
key: "stop",
|
|
74339
74389
|
value: function () {
|
|
@@ -74586,6 +74636,13 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74586
74636
|
}, {
|
|
74587
74637
|
key: "prepareMedia",
|
|
74588
74638
|
value: function prepareMedia(media) {
|
|
74639
|
+
// SSP widget: signal the consumer to fetch an ad before this media's turn to play.
|
|
74640
|
+
// The consumer calls media.setSspAdUrl() to resolve it; if it never arrives,
|
|
74641
|
+
// Media.run() skips the widget and advances normally.
|
|
74642
|
+
if (media.mediaType === 'ssp') {
|
|
74643
|
+
this.xlr.emitter.emit('sspWidgetRequest', media);
|
|
74644
|
+
return;
|
|
74645
|
+
}
|
|
74589
74646
|
if (media.mediaType === 'video') {
|
|
74590
74647
|
prepareVideoMedia(media, this);
|
|
74591
74648
|
} else if (media.mediaType === 'image' && media.url !== null) {
|
|
@@ -74802,7 +74859,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74802
74859
|
}
|
|
74803
74860
|
};
|
|
74804
74861
|
if (oldMedia) {
|
|
74805
|
-
|
|
74862
|
+
// Skip hiding old media when it is the same object as new media
|
|
74863
|
+
// (single-media loop): removing it would also remove the element
|
|
74864
|
+
// that is about to be shown, leaving the region blank.
|
|
74865
|
+
if (oldMedia !== newMedia) {
|
|
74866
|
+
hideOldMedia();
|
|
74867
|
+
}
|
|
74806
74868
|
newMedia.run();
|
|
74807
74869
|
} else {
|
|
74808
74870
|
newMedia.run();
|