@xibosignage/xibo-layout-renderer 1.0.9 → 1.0.11
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/Types/Layout/Layout.types.d.ts +2 -0
- package/dist/src/Types/Media/Media.types.d.ts +1 -0
- package/dist/xibo-layout-renderer.cjs.js +59 -12
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +3 -0
- package/dist/xibo-layout-renderer.esm.js +59 -12
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +59 -12
- package/dist/xibo-layout-renderer.min.js +8 -8
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -663,7 +663,8 @@ var XiboLayoutRenderer = (function (exports) {
|
|
|
663
663
|
},
|
|
664
664
|
emitter: {},
|
|
665
665
|
index: -1,
|
|
666
|
-
actionController: undefined
|
|
666
|
+
actionController: undefined,
|
|
667
|
+
enableStat: false
|
|
667
668
|
};
|
|
668
669
|
|
|
669
670
|
function nextId(options) {
|
|
@@ -848,7 +849,9 @@ var XiboLayoutRenderer = (function (exports) {
|
|
|
848
849
|
function composeBgUrlByPlatform(platform, params) {
|
|
849
850
|
var bgImageUrl = params.layoutBackgroundDownloadUrl.replace(":id", params.layout.id) + '?preview=1&width=' + params.layout.sWidth + '&height=' + params.layout.sHeight + '&dynamic&proportional=0';
|
|
850
851
|
if (platform === 'chromeOS') {
|
|
851
|
-
bgImageUrl =
|
|
852
|
+
bgImageUrl = composeMediaUrl({
|
|
853
|
+
uri: params.layout.bgImage
|
|
854
|
+
});
|
|
852
855
|
}
|
|
853
856
|
return bgImageUrl;
|
|
854
857
|
}
|
|
@@ -69556,7 +69559,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
69556
69559
|
on: function on(event, callback) {
|
|
69557
69560
|
return {};
|
|
69558
69561
|
},
|
|
69559
|
-
emitter: {}
|
|
69562
|
+
emitter: {},
|
|
69563
|
+
enableStat: false
|
|
69560
69564
|
};
|
|
69561
69565
|
|
|
69562
69566
|
/*
|
|
@@ -72811,6 +72815,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72811
72815
|
var mediaTimeCount = 0;
|
|
72812
72816
|
var emitter = createNanoEvents();
|
|
72813
72817
|
var mediaObject = _objectSpread2(_objectSpread2({}, initialMedia), props);
|
|
72818
|
+
var statsBC = new BroadcastChannel('statsBC');
|
|
72814
72819
|
var startMediaTimer = function startMediaTimer(media) {
|
|
72815
72820
|
mediaTimer = setInterval(function () {
|
|
72816
72821
|
mediaTimeCount++;
|
|
@@ -72834,12 +72839,32 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72834
72839
|
} else {
|
|
72835
72840
|
startMediaTimer(media);
|
|
72836
72841
|
}
|
|
72842
|
+
// Check if stats are enabled for the layout
|
|
72843
|
+
if (media.enableStat) {
|
|
72844
|
+
statsBC.postMessage({
|
|
72845
|
+
action: 'START_STAT',
|
|
72846
|
+
mediaId: parseInt(media.id),
|
|
72847
|
+
layoutId: media.region.layout.id,
|
|
72848
|
+
scheduleId: media.region.layout.scheduleId,
|
|
72849
|
+
type: 'media'
|
|
72850
|
+
});
|
|
72851
|
+
}
|
|
72837
72852
|
});
|
|
72838
72853
|
emitter.on('end', function (media) {
|
|
72839
72854
|
if (mediaTimer) {
|
|
72840
72855
|
clearInterval(mediaTimer);
|
|
72841
72856
|
mediaTimeCount = 0;
|
|
72842
72857
|
}
|
|
72858
|
+
// Check if stats are enabled for the layout
|
|
72859
|
+
if (media.enableStat) {
|
|
72860
|
+
statsBC.postMessage({
|
|
72861
|
+
action: 'END_STAT',
|
|
72862
|
+
mediaId: parseInt(media.id),
|
|
72863
|
+
layoutId: media.region.layout.id,
|
|
72864
|
+
scheduleId: media.region.layout.scheduleId,
|
|
72865
|
+
type: 'media'
|
|
72866
|
+
});
|
|
72867
|
+
}
|
|
72843
72868
|
media.region.playNextMedia();
|
|
72844
72869
|
});
|
|
72845
72870
|
mediaObject.on = function (event, callback) {
|
|
@@ -72847,7 +72872,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72847
72872
|
};
|
|
72848
72873
|
mediaObject.emitter = emitter;
|
|
72849
72874
|
mediaObject.init = function () {
|
|
72850
|
-
var _self$xml, _self$xml2, _self$xml3, _self$xml4, _self$xml5;
|
|
72875
|
+
var _self$xml, _self$xml2, _self$xml3, _self$xml4, _self$xml5, _self$xml6;
|
|
72851
72876
|
var self = mediaObject;
|
|
72852
72877
|
self.id = props.mediaId;
|
|
72853
72878
|
self.fileId = ((_self$xml = self.xml) === null || _self$xml === void 0 ? void 0 : _self$xml.getAttribute('fileId')) || '';
|
|
@@ -72857,9 +72882,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72857
72882
|
self.mediaType = ((_self$xml2 = self.xml) === null || _self$xml2 === void 0 ? void 0 : _self$xml2.getAttribute('type')) || '';
|
|
72858
72883
|
self.render = ((_self$xml3 = self.xml) === null || _self$xml3 === void 0 ? void 0 : _self$xml3.getAttribute('render')) || '';
|
|
72859
72884
|
self.duration = parseInt((_self$xml4 = self.xml) === null || _self$xml4 === void 0 ? void 0 : _self$xml4.getAttribute('duration')) || 0;
|
|
72885
|
+
self.enableStat = Boolean(((_self$xml5 = self.xml) === null || _self$xml5 === void 0 ? void 0 : _self$xml5.getAttribute('enableStat')) || false);
|
|
72860
72886
|
self.options = _objectSpread2({}, props.options);
|
|
72861
72887
|
var $mediaIframe = document.createElement('iframe');
|
|
72862
|
-
var mediaOptions = (_self$
|
|
72888
|
+
var mediaOptions = (_self$xml6 = self.xml) === null || _self$xml6 === void 0 ? void 0 : _self$xml6.getElementsByTagName('options');
|
|
72863
72889
|
if (mediaOptions) {
|
|
72864
72890
|
for (var _i = 0, _Array$from = Array.from(mediaOptions); _i < _Array$from.length; _i++) {
|
|
72865
72891
|
var _options = _Array$from[_i];
|
|
@@ -73887,9 +73913,19 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73887
73913
|
layout: layout || initialLayout
|
|
73888
73914
|
};
|
|
73889
73915
|
var emitter = createNanoEvents();
|
|
73916
|
+
var statsBC = new BroadcastChannel('statsBC');
|
|
73890
73917
|
emitter.on('start', function (layout) {
|
|
73891
73918
|
layout.done = false;
|
|
73892
73919
|
console.debug('Layout start emitted > Layout ID > ', layout.id);
|
|
73920
|
+
// Check if stats are enabled for the layout
|
|
73921
|
+
if (layout.enableStat) {
|
|
73922
|
+
statsBC.postMessage({
|
|
73923
|
+
action: 'START_STAT',
|
|
73924
|
+
layoutId: layout.id,
|
|
73925
|
+
scheduleId: layout.scheduleId,
|
|
73926
|
+
type: 'layout'
|
|
73927
|
+
});
|
|
73928
|
+
}
|
|
73893
73929
|
});
|
|
73894
73930
|
emitter.on('end', /*#__PURE__*/function () {
|
|
73895
73931
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layout) {
|
|
@@ -73907,13 +73943,22 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73907
73943
|
if ($layout !== null) {
|
|
73908
73944
|
$layout.remove();
|
|
73909
73945
|
}
|
|
73946
|
+
// Check if stats are enabled for the layout
|
|
73947
|
+
if (layout.enableStat) {
|
|
73948
|
+
statsBC.postMessage({
|
|
73949
|
+
action: 'END_STAT',
|
|
73950
|
+
layoutId: layout.id,
|
|
73951
|
+
scheduleId: layout.scheduleId,
|
|
73952
|
+
type: 'layout'
|
|
73953
|
+
});
|
|
73954
|
+
}
|
|
73910
73955
|
if (xlr.config.platform !== 'CMS') {
|
|
73911
73956
|
// Transition next layout to current layout and prepare next layout if exist
|
|
73912
73957
|
xlr.prepareLayouts().then(function (parent) {
|
|
73913
73958
|
xlr.playSchedules(parent);
|
|
73914
73959
|
});
|
|
73915
73960
|
}
|
|
73916
|
-
case
|
|
73961
|
+
case 7:
|
|
73917
73962
|
case "end":
|
|
73918
73963
|
return _context.stop();
|
|
73919
73964
|
}
|
|
@@ -73951,7 +73996,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73951
73996
|
layoutObject.parseXlf();
|
|
73952
73997
|
};
|
|
73953
73998
|
layoutObject.parseXlf = function () {
|
|
73954
|
-
var _layout$layoutNode, _layout$layoutNode2, _layout$layoutNode3, _layout$layoutNode4, _layout$layoutNode5, _layout$layoutNode6, _layout$layoutNode7, _layout$layoutNode8;
|
|
73999
|
+
var _layout$layoutNode, _layout$layoutNode2, _layout$layoutNode3, _layout$layoutNode4, _layout$layoutNode5, _layout$layoutNode6, _layout$layoutNode7, _layout$layoutNode8, _layout$layoutNode9;
|
|
73955
74000
|
var layout = this;
|
|
73956
74001
|
var options = layout.options;
|
|
73957
74002
|
layout.done = false;
|
|
@@ -73980,6 +74025,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73980
74025
|
layout.xw = Number((_layout$layoutNode = layout.layoutNode) === null || _layout$layoutNode === void 0 || (_layout$layoutNode = _layout$layoutNode.firstElementChild) === null || _layout$layoutNode === void 0 ? void 0 : _layout$layoutNode.getAttribute('width'));
|
|
73981
74026
|
layout.xh = Number((_layout$layoutNode2 = layout.layoutNode) === null || _layout$layoutNode2 === void 0 || (_layout$layoutNode2 = _layout$layoutNode2.firstElementChild) === null || _layout$layoutNode2 === void 0 ? void 0 : _layout$layoutNode2.getAttribute('height'));
|
|
73982
74027
|
layout.zIndex = Number((_layout$layoutNode3 = layout.layoutNode) === null || _layout$layoutNode3 === void 0 || (_layout$layoutNode3 = _layout$layoutNode3.firstElementChild) === null || _layout$layoutNode3 === void 0 ? void 0 : _layout$layoutNode3.getAttribute('zindex')) || 0;
|
|
74028
|
+
layout.enableStat = Boolean(((_layout$layoutNode4 = layout.layoutNode) === null || _layout$layoutNode4 === void 0 || (_layout$layoutNode4 = _layout$layoutNode4.firstElementChild) === null || _layout$layoutNode4 === void 0 ? void 0 : _layout$layoutNode4.getAttribute('enableStat')) || false);
|
|
73983
74029
|
/* Calculate Scale Factor */
|
|
73984
74030
|
layout.scaleFactor = Math.min(layout.sw / layout.xw, layout.sh / layout.xh);
|
|
73985
74031
|
layout.sWidth = layout.xw * layout.scaleFactor;
|
|
@@ -73998,8 +74044,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73998
74044
|
$layout.style.zIndex = "".concat(layout.zIndex);
|
|
73999
74045
|
}
|
|
74000
74046
|
/* Set the layout background */
|
|
74001
|
-
layout.bgColor = ((_layout$
|
|
74002
|
-
layout.bgImage = ((_layout$
|
|
74047
|
+
layout.bgColor = ((_layout$layoutNode5 = layout.layoutNode) === null || _layout$layoutNode5 === void 0 || (_layout$layoutNode5 = _layout$layoutNode5.firstElementChild) === null || _layout$layoutNode5 === void 0 ? void 0 : _layout$layoutNode5.getAttribute('bgcolor')) || '';
|
|
74048
|
+
layout.bgImage = ((_layout$layoutNode6 = layout.layoutNode) === null || _layout$layoutNode6 === void 0 || (_layout$layoutNode6 = _layout$layoutNode6.firstElementChild) === null || _layout$layoutNode6 === void 0 ? void 0 : _layout$layoutNode6.getAttribute('background')) || '';
|
|
74003
74049
|
if (!(layout.bgImage === "" || typeof layout.bgImage === 'undefined')) {
|
|
74004
74050
|
/* Extract the image ID from the filename */
|
|
74005
74051
|
layout.bgId = layout.bgImage.substring(0, layout.bgImage.indexOf('.'));
|
|
@@ -74022,19 +74068,19 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74022
74068
|
$layout.style.display = 'none';
|
|
74023
74069
|
}
|
|
74024
74070
|
// Create actions
|
|
74025
|
-
var layoutActions = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74071
|
+
var layoutActions = Array.from((layout === null || layout === void 0 || (_layout$layoutNode7 = layout.layoutNode) === null || _layout$layoutNode7 === void 0 ? void 0 : _layout$layoutNode7.getElementsByTagName('action')) || []);
|
|
74026
74072
|
Array.from(layoutActions).forEach(function (actionXml, indx) {
|
|
74027
74073
|
layout.actions.push(new Action((actionXml === null || actionXml === void 0 ? void 0 : actionXml.getAttribute('id')) || '', actionXml));
|
|
74028
74074
|
});
|
|
74029
74075
|
// Create interactive actions
|
|
74030
74076
|
layout.actionController = new ActionController(layout, layout.actions, options);
|
|
74031
74077
|
// Create drawer
|
|
74032
|
-
var layoutDrawers = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74078
|
+
var layoutDrawers = Array.from((layout === null || layout === void 0 || (_layout$layoutNode8 = layout.layoutNode) === null || _layout$layoutNode8 === void 0 ? void 0 : _layout$layoutNode8.getElementsByTagName('drawer')) || []);
|
|
74033
74079
|
Array.from(layoutDrawers).forEach(function (layoutDrawerXml) {
|
|
74034
74080
|
layout.drawer = layoutDrawerXml;
|
|
74035
74081
|
});
|
|
74036
74082
|
// Create regions
|
|
74037
|
-
var layoutRegions = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74083
|
+
var layoutRegions = Array.from((layout === null || layout === void 0 || (_layout$layoutNode9 = layout.layoutNode) === null || _layout$layoutNode9 === void 0 ? void 0 : _layout$layoutNode9.getElementsByTagName('region')) || []);
|
|
74038
74084
|
Array.from(layoutRegions).forEach(function (regionXml, indx) {
|
|
74039
74085
|
var regionObj = Region(layout, regionXml, (regionXml === null || regionXml === void 0 ? void 0 : regionXml.getAttribute('id')) || '', options, xlr);
|
|
74040
74086
|
regionObj.index = indx;
|
|
@@ -74552,6 +74598,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74552
74598
|
var xlrLayoutObj = initialLayout;
|
|
74553
74599
|
xlrLayoutObj.id = Number(inputLayout.layoutId);
|
|
74554
74600
|
xlrLayoutObj.layoutId = Number(inputLayout.layoutId);
|
|
74601
|
+
xlrLayoutObj.scheduleId = (inputLayout === null || inputLayout === void 0 ? void 0 : inputLayout.scheduleId) || undefined;
|
|
74555
74602
|
xlrLayoutObj.options = newOptions;
|
|
74556
74603
|
xlrLayoutObj.index = getIndexByLayoutId(_this3.inputLayouts, xlrLayoutObj.layoutId).index;
|
|
74557
74604
|
resolve(Layout(layoutXlfNode, newOptions, self, xlrLayoutObj));
|