@xibosignage/xibo-layout-renderer 1.0.9 → 1.0.10
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 +56 -11
- 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 +56 -11
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +56 -11
- package/dist/xibo-layout-renderer.min.js +2 -2
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -71,6 +71,7 @@ interface IMedia {
|
|
|
71
71
|
region: IRegion;
|
|
72
72
|
fileId: string;
|
|
73
73
|
emitter: Emitter<IMediaEvents>;
|
|
74
|
+
enableStat: boolean;
|
|
74
75
|
}
|
|
75
76
|
declare const initialMedia: IMedia;
|
|
76
77
|
|
|
@@ -190,6 +191,7 @@ type OptionsType = {
|
|
|
190
191
|
interface ILayout {
|
|
191
192
|
id: number | null;
|
|
192
193
|
layoutId: number | null;
|
|
194
|
+
scheduleId?: number;
|
|
193
195
|
sw: number | null;
|
|
194
196
|
sh: number | null;
|
|
195
197
|
xw: number | null;
|
|
@@ -228,6 +230,7 @@ interface ILayout {
|
|
|
228
230
|
resetLayout(): Promise<void>;
|
|
229
231
|
index: number;
|
|
230
232
|
actionController: ActionController | undefined;
|
|
233
|
+
enableStat: boolean;
|
|
231
234
|
}
|
|
232
235
|
declare const initialLayout: ILayout;
|
|
233
236
|
type GetLayoutParamType = {
|
|
@@ -660,7 +660,8 @@ var initialLayout = {
|
|
|
660
660
|
},
|
|
661
661
|
emitter: {},
|
|
662
662
|
index: -1,
|
|
663
|
-
actionController: undefined
|
|
663
|
+
actionController: undefined,
|
|
664
|
+
enableStat: false
|
|
664
665
|
};
|
|
665
666
|
|
|
666
667
|
function nextId(options) {
|
|
@@ -69553,7 +69554,8 @@ var initialMedia = {
|
|
|
69553
69554
|
on: function on(event, callback) {
|
|
69554
69555
|
return {};
|
|
69555
69556
|
},
|
|
69556
|
-
emitter: {}
|
|
69557
|
+
emitter: {},
|
|
69558
|
+
enableStat: false
|
|
69557
69559
|
};
|
|
69558
69560
|
|
|
69559
69561
|
/*
|
|
@@ -72808,6 +72810,7 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
72808
72810
|
var mediaTimeCount = 0;
|
|
72809
72811
|
var emitter = createNanoEvents();
|
|
72810
72812
|
var mediaObject = _objectSpread2(_objectSpread2({}, initialMedia), props);
|
|
72813
|
+
var statsBC = new BroadcastChannel('statsBC');
|
|
72811
72814
|
var startMediaTimer = function startMediaTimer(media) {
|
|
72812
72815
|
mediaTimer = setInterval(function () {
|
|
72813
72816
|
mediaTimeCount++;
|
|
@@ -72831,12 +72834,32 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
72831
72834
|
} else {
|
|
72832
72835
|
startMediaTimer(media);
|
|
72833
72836
|
}
|
|
72837
|
+
// Check if stats are enabled for the layout
|
|
72838
|
+
if (media.enableStat) {
|
|
72839
|
+
statsBC.postMessage({
|
|
72840
|
+
action: 'START_STAT',
|
|
72841
|
+
mediaId: parseInt(media.id),
|
|
72842
|
+
layoutId: media.region.layout.id,
|
|
72843
|
+
scheduleId: media.region.layout.scheduleId,
|
|
72844
|
+
type: 'media'
|
|
72845
|
+
});
|
|
72846
|
+
}
|
|
72834
72847
|
});
|
|
72835
72848
|
emitter.on('end', function (media) {
|
|
72836
72849
|
if (mediaTimer) {
|
|
72837
72850
|
clearInterval(mediaTimer);
|
|
72838
72851
|
mediaTimeCount = 0;
|
|
72839
72852
|
}
|
|
72853
|
+
// Check if stats are enabled for the layout
|
|
72854
|
+
if (media.enableStat) {
|
|
72855
|
+
statsBC.postMessage({
|
|
72856
|
+
action: 'END_STAT',
|
|
72857
|
+
mediaId: parseInt(media.id),
|
|
72858
|
+
layoutId: media.region.layout.id,
|
|
72859
|
+
scheduleId: media.region.layout.scheduleId,
|
|
72860
|
+
type: 'media'
|
|
72861
|
+
});
|
|
72862
|
+
}
|
|
72840
72863
|
media.region.playNextMedia();
|
|
72841
72864
|
});
|
|
72842
72865
|
mediaObject.on = function (event, callback) {
|
|
@@ -72844,7 +72867,7 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
72844
72867
|
};
|
|
72845
72868
|
mediaObject.emitter = emitter;
|
|
72846
72869
|
mediaObject.init = function () {
|
|
72847
|
-
var _self$xml, _self$xml2, _self$xml3, _self$xml4, _self$xml5;
|
|
72870
|
+
var _self$xml, _self$xml2, _self$xml3, _self$xml4, _self$xml5, _self$xml6;
|
|
72848
72871
|
var self = mediaObject;
|
|
72849
72872
|
self.id = props.mediaId;
|
|
72850
72873
|
self.fileId = ((_self$xml = self.xml) === null || _self$xml === void 0 ? void 0 : _self$xml.getAttribute('fileId')) || '';
|
|
@@ -72854,9 +72877,10 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
72854
72877
|
self.mediaType = ((_self$xml2 = self.xml) === null || _self$xml2 === void 0 ? void 0 : _self$xml2.getAttribute('type')) || '';
|
|
72855
72878
|
self.render = ((_self$xml3 = self.xml) === null || _self$xml3 === void 0 ? void 0 : _self$xml3.getAttribute('render')) || '';
|
|
72856
72879
|
self.duration = parseInt((_self$xml4 = self.xml) === null || _self$xml4 === void 0 ? void 0 : _self$xml4.getAttribute('duration')) || 0;
|
|
72880
|
+
self.enableStat = Boolean(((_self$xml5 = self.xml) === null || _self$xml5 === void 0 ? void 0 : _self$xml5.getAttribute('enableStat')) || false);
|
|
72857
72881
|
self.options = _objectSpread2({}, props.options);
|
|
72858
72882
|
var $mediaIframe = document.createElement('iframe');
|
|
72859
|
-
var mediaOptions = (_self$
|
|
72883
|
+
var mediaOptions = (_self$xml6 = self.xml) === null || _self$xml6 === void 0 ? void 0 : _self$xml6.getElementsByTagName('options');
|
|
72860
72884
|
if (mediaOptions) {
|
|
72861
72885
|
for (var _i = 0, _Array$from = Array.from(mediaOptions); _i < _Array$from.length; _i++) {
|
|
72862
72886
|
var _options = _Array$from[_i];
|
|
@@ -73884,9 +73908,19 @@ function Layout(data, options, xlr, layout) {
|
|
|
73884
73908
|
layout: layout || initialLayout
|
|
73885
73909
|
};
|
|
73886
73910
|
var emitter = createNanoEvents();
|
|
73911
|
+
var statsBC = new BroadcastChannel('statsBC');
|
|
73887
73912
|
emitter.on('start', function (layout) {
|
|
73888
73913
|
layout.done = false;
|
|
73889
73914
|
console.debug('Layout start emitted > Layout ID > ', layout.id);
|
|
73915
|
+
// Check if stats are enabled for the layout
|
|
73916
|
+
if (layout.enableStat) {
|
|
73917
|
+
statsBC.postMessage({
|
|
73918
|
+
action: 'START_STAT',
|
|
73919
|
+
layoutId: layout.id,
|
|
73920
|
+
scheduleId: layout.scheduleId,
|
|
73921
|
+
type: 'layout'
|
|
73922
|
+
});
|
|
73923
|
+
}
|
|
73890
73924
|
});
|
|
73891
73925
|
emitter.on('end', /*#__PURE__*/function () {
|
|
73892
73926
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layout) {
|
|
@@ -73904,13 +73938,22 @@ function Layout(data, options, xlr, layout) {
|
|
|
73904
73938
|
if ($layout !== null) {
|
|
73905
73939
|
$layout.remove();
|
|
73906
73940
|
}
|
|
73941
|
+
// Check if stats are enabled for the layout
|
|
73942
|
+
if (layout.enableStat) {
|
|
73943
|
+
statsBC.postMessage({
|
|
73944
|
+
action: 'END_STAT',
|
|
73945
|
+
layoutId: layout.id,
|
|
73946
|
+
scheduleId: layout.scheduleId,
|
|
73947
|
+
type: 'layout'
|
|
73948
|
+
});
|
|
73949
|
+
}
|
|
73907
73950
|
if (xlr.config.platform !== 'CMS') {
|
|
73908
73951
|
// Transition next layout to current layout and prepare next layout if exist
|
|
73909
73952
|
xlr.prepareLayouts().then(function (parent) {
|
|
73910
73953
|
xlr.playSchedules(parent);
|
|
73911
73954
|
});
|
|
73912
73955
|
}
|
|
73913
|
-
case
|
|
73956
|
+
case 7:
|
|
73914
73957
|
case "end":
|
|
73915
73958
|
return _context.stop();
|
|
73916
73959
|
}
|
|
@@ -73948,7 +73991,7 @@ function Layout(data, options, xlr, layout) {
|
|
|
73948
73991
|
layoutObject.parseXlf();
|
|
73949
73992
|
};
|
|
73950
73993
|
layoutObject.parseXlf = function () {
|
|
73951
|
-
var _layout$layoutNode, _layout$layoutNode2, _layout$layoutNode3, _layout$layoutNode4, _layout$layoutNode5, _layout$layoutNode6, _layout$layoutNode7, _layout$layoutNode8;
|
|
73994
|
+
var _layout$layoutNode, _layout$layoutNode2, _layout$layoutNode3, _layout$layoutNode4, _layout$layoutNode5, _layout$layoutNode6, _layout$layoutNode7, _layout$layoutNode8, _layout$layoutNode9;
|
|
73952
73995
|
var layout = this;
|
|
73953
73996
|
var options = layout.options;
|
|
73954
73997
|
layout.done = false;
|
|
@@ -73977,6 +74020,7 @@ function Layout(data, options, xlr, layout) {
|
|
|
73977
74020
|
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'));
|
|
73978
74021
|
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'));
|
|
73979
74022
|
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;
|
|
74023
|
+
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);
|
|
73980
74024
|
/* Calculate Scale Factor */
|
|
73981
74025
|
layout.scaleFactor = Math.min(layout.sw / layout.xw, layout.sh / layout.xh);
|
|
73982
74026
|
layout.sWidth = layout.xw * layout.scaleFactor;
|
|
@@ -73995,8 +74039,8 @@ function Layout(data, options, xlr, layout) {
|
|
|
73995
74039
|
$layout.style.zIndex = "".concat(layout.zIndex);
|
|
73996
74040
|
}
|
|
73997
74041
|
/* Set the layout background */
|
|
73998
|
-
layout.bgColor = ((_layout$
|
|
73999
|
-
layout.bgImage = ((_layout$
|
|
74042
|
+
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')) || '';
|
|
74043
|
+
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')) || '';
|
|
74000
74044
|
if (!(layout.bgImage === "" || typeof layout.bgImage === 'undefined')) {
|
|
74001
74045
|
/* Extract the image ID from the filename */
|
|
74002
74046
|
layout.bgId = layout.bgImage.substring(0, layout.bgImage.indexOf('.'));
|
|
@@ -74019,19 +74063,19 @@ function Layout(data, options, xlr, layout) {
|
|
|
74019
74063
|
$layout.style.display = 'none';
|
|
74020
74064
|
}
|
|
74021
74065
|
// Create actions
|
|
74022
|
-
var layoutActions = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74066
|
+
var layoutActions = Array.from((layout === null || layout === void 0 || (_layout$layoutNode7 = layout.layoutNode) === null || _layout$layoutNode7 === void 0 ? void 0 : _layout$layoutNode7.getElementsByTagName('action')) || []);
|
|
74023
74067
|
Array.from(layoutActions).forEach(function (actionXml, indx) {
|
|
74024
74068
|
layout.actions.push(new Action((actionXml === null || actionXml === void 0 ? void 0 : actionXml.getAttribute('id')) || '', actionXml));
|
|
74025
74069
|
});
|
|
74026
74070
|
// Create interactive actions
|
|
74027
74071
|
layout.actionController = new ActionController(layout, layout.actions, options);
|
|
74028
74072
|
// Create drawer
|
|
74029
|
-
var layoutDrawers = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74073
|
+
var layoutDrawers = Array.from((layout === null || layout === void 0 || (_layout$layoutNode8 = layout.layoutNode) === null || _layout$layoutNode8 === void 0 ? void 0 : _layout$layoutNode8.getElementsByTagName('drawer')) || []);
|
|
74030
74074
|
Array.from(layoutDrawers).forEach(function (layoutDrawerXml) {
|
|
74031
74075
|
layout.drawer = layoutDrawerXml;
|
|
74032
74076
|
});
|
|
74033
74077
|
// Create regions
|
|
74034
|
-
var layoutRegions = Array.from((layout === null || layout === void 0 || (_layout$
|
|
74078
|
+
var layoutRegions = Array.from((layout === null || layout === void 0 || (_layout$layoutNode9 = layout.layoutNode) === null || _layout$layoutNode9 === void 0 ? void 0 : _layout$layoutNode9.getElementsByTagName('region')) || []);
|
|
74035
74079
|
Array.from(layoutRegions).forEach(function (regionXml, indx) {
|
|
74036
74080
|
var regionObj = Region(layout, regionXml, (regionXml === null || regionXml === void 0 ? void 0 : regionXml.getAttribute('id')) || '', options, xlr);
|
|
74037
74081
|
regionObj.index = indx;
|
|
@@ -74549,6 +74593,7 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74549
74593
|
var xlrLayoutObj = initialLayout;
|
|
74550
74594
|
xlrLayoutObj.id = Number(inputLayout.layoutId);
|
|
74551
74595
|
xlrLayoutObj.layoutId = Number(inputLayout.layoutId);
|
|
74596
|
+
xlrLayoutObj.scheduleId = (inputLayout === null || inputLayout === void 0 ? void 0 : inputLayout.scheduleId) || undefined;
|
|
74552
74597
|
xlrLayoutObj.options = newOptions;
|
|
74553
74598
|
xlrLayoutObj.index = getIndexByLayoutId(_this3.inputLayouts, xlrLayoutObj.layoutId).index;
|
|
74554
74599
|
resolve(Layout(layoutXlfNode, newOptions, self, xlrLayoutObj));
|