@xibosignage/xibo-layout-renderer 1.0.14 → 1.0.16
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/Generators/index.d.ts +1 -1
- package/dist/src/Modules/Media/VideoMedia.d.ts +1 -0
- package/dist/xibo-layout-renderer.cjs.js +143 -57
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +19 -1
- package/dist/xibo-layout-renderer.esm.js +136 -58
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +143 -57
- package/dist/xibo-layout-renderer.min.js +8 -8
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -798,6 +798,34 @@ var XiboLayoutRenderer = (function (exports) {
|
|
|
798
798
|
}));
|
|
799
799
|
return _fetchJSON.apply(this, arguments);
|
|
800
800
|
}
|
|
801
|
+
function fetchText(_x5) {
|
|
802
|
+
return _fetchText.apply(this, arguments);
|
|
803
|
+
}
|
|
804
|
+
function _fetchText() {
|
|
805
|
+
_fetchText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url) {
|
|
806
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
807
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
808
|
+
case 0:
|
|
809
|
+
return _context4.abrupt("return", fetch(url).then(function (res) {
|
|
810
|
+
return res.text();
|
|
811
|
+
}).then(function (responseText) {
|
|
812
|
+
if (String(responseText).length > 0) {
|
|
813
|
+
return responseText;
|
|
814
|
+
} else {
|
|
815
|
+
return '';
|
|
816
|
+
}
|
|
817
|
+
})["catch"](function (err) {
|
|
818
|
+
console.debug(err);
|
|
819
|
+
return err === null || err === void 0 ? void 0 : err.message;
|
|
820
|
+
}));
|
|
821
|
+
case 1:
|
|
822
|
+
case "end":
|
|
823
|
+
return _context4.stop();
|
|
824
|
+
}
|
|
825
|
+
}, _callee4);
|
|
826
|
+
}));
|
|
827
|
+
return _fetchText.apply(this, arguments);
|
|
828
|
+
}
|
|
801
829
|
function getFileExt(filename) {
|
|
802
830
|
var filenameArr = String(filename).split('.');
|
|
803
831
|
return filenameArr[filenameArr.length - 1];
|
|
@@ -873,6 +901,9 @@ var XiboLayoutRenderer = (function (exports) {
|
|
|
873
901
|
index: 0
|
|
874
902
|
};
|
|
875
903
|
}
|
|
904
|
+
function isEmpty$1(input) {
|
|
905
|
+
return !Boolean(input) || String(input).length === 0;
|
|
906
|
+
}
|
|
876
907
|
function getAllAttributes(elem) {
|
|
877
908
|
if (!elem || elem === null) {
|
|
878
909
|
return {};
|
|
@@ -72638,7 +72669,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72638
72669
|
return $media;
|
|
72639
72670
|
}
|
|
72640
72671
|
function VideoMedia(media, xlr) {
|
|
72641
|
-
|
|
72672
|
+
var videoMediaInstance = {
|
|
72642
72673
|
init: function init() {
|
|
72643
72674
|
var vjsPlayer = media.player;
|
|
72644
72675
|
if (vjsPlayer !== undefined) {
|
|
@@ -72666,10 +72697,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72666
72697
|
// Temporary setting
|
|
72667
72698
|
expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
|
|
72668
72699
|
})["finally"](function () {
|
|
72669
|
-
|
|
72670
|
-
vjsPlayer.dispose();
|
|
72671
|
-
media.emitter.emit('end', media);
|
|
72700
|
+
videoMediaInstance.stop();
|
|
72672
72701
|
});
|
|
72702
|
+
} else {
|
|
72703
|
+
videoMediaInstance.stop();
|
|
72673
72704
|
}
|
|
72674
72705
|
case 5:
|
|
72675
72706
|
case "end":
|
|
@@ -72689,88 +72720,130 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72689
72720
|
});
|
|
72690
72721
|
vjsPlayer.on('ready', function () {
|
|
72691
72722
|
vjsPlayer.muted(true);
|
|
72692
|
-
|
|
72693
|
-
|
|
72694
|
-
|
|
72695
|
-
|
|
72696
|
-
|
|
72697
|
-
|
|
72698
|
-
|
|
72699
|
-
|
|
72700
|
-
|
|
72701
|
-
|
|
72702
|
-
|
|
72703
|
-
|
|
72704
|
-
|
|
72705
|
-
|
|
72706
|
-
|
|
72707
|
-
|
|
72708
|
-
|
|
72709
|
-
|
|
72710
|
-
|
|
72711
|
-
|
|
72712
|
-
|
|
72713
|
-
|
|
72714
|
-
|
|
72715
|
-
|
|
72716
|
-
|
|
72717
|
-
};
|
|
72718
|
-
}
|
|
72719
|
-
}
|
|
72723
|
+
// Race promise between a 0.5s play and a 5s skip
|
|
72724
|
+
Promise.race([new Promise(function (resolve, reject) {
|
|
72725
|
+
return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
72726
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
72727
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72728
|
+
case 0:
|
|
72729
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72730
|
+
// Try to force play here
|
|
72731
|
+
_context2.prev = 1;
|
|
72732
|
+
_context2.next = 4;
|
|
72733
|
+
return vjsPlayer.play();
|
|
72734
|
+
case 4:
|
|
72735
|
+
// Resolve if play works
|
|
72736
|
+
resolve(true);
|
|
72737
|
+
_context2.next = 10;
|
|
72738
|
+
break;
|
|
72739
|
+
case 7:
|
|
72740
|
+
_context2.prev = 7;
|
|
72741
|
+
_context2.t0 = _context2["catch"](1);
|
|
72742
|
+
// Reject race if play fails
|
|
72743
|
+
reject('Play failed');
|
|
72744
|
+
case 10:
|
|
72745
|
+
case "end":
|
|
72746
|
+
return _context2.stop();
|
|
72747
|
+
}
|
|
72748
|
+
}, _callee2, null, [[1, 7]]);
|
|
72749
|
+
})), 100);
|
|
72750
|
+
}), new Promise(function (_, reject) {
|
|
72751
|
+
return setTimeout(function () {
|
|
72752
|
+
return reject('Timeout');
|
|
72753
|
+
}, 5000);
|
|
72754
|
+
})]).then(function () {
|
|
72755
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72756
|
+
})["catch"]( /*#__PURE__*/function () {
|
|
72757
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
|
|
72758
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
72759
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
72760
|
+
case 0:
|
|
72761
|
+
if (!(error === 'Timeout')) {
|
|
72762
|
+
_context3.next = 5;
|
|
72763
|
+
break;
|
|
72764
|
+
}
|
|
72765
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72766
|
+
videoMediaInstance.stop();
|
|
72767
|
+
_context3.next = 9;
|
|
72768
|
+
break;
|
|
72769
|
+
case 5:
|
|
72770
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72771
|
+
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72772
|
+
_context3.next = 9;
|
|
72773
|
+
break;
|
|
72774
|
+
}
|
|
72775
|
+
_context3.next = 9;
|
|
72776
|
+
return playerReportFault('Media autoplay error');
|
|
72777
|
+
case 9:
|
|
72778
|
+
case "end":
|
|
72779
|
+
return _context3.stop();
|
|
72780
|
+
}
|
|
72781
|
+
}, _callee3);
|
|
72782
|
+
}));
|
|
72783
|
+
return function (_x2) {
|
|
72784
|
+
return _ref3.apply(this, arguments);
|
|
72785
|
+
};
|
|
72786
|
+
}());
|
|
72720
72787
|
});
|
|
72721
72788
|
vjsPlayer.on('playing', function () {
|
|
72722
72789
|
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72723
72790
|
vjsPlayer.muted(media.muted);
|
|
72724
72791
|
});
|
|
72725
72792
|
vjsPlayer.on('error', /*#__PURE__*/function () {
|
|
72726
|
-
var
|
|
72727
|
-
return _regeneratorRuntime().wrap(function
|
|
72728
|
-
while (1) switch (
|
|
72793
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
|
|
72794
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
72795
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
72729
72796
|
case 0:
|
|
72730
72797
|
console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72731
72798
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72732
|
-
|
|
72799
|
+
_context4.next = 6;
|
|
72733
72800
|
break;
|
|
72734
72801
|
}
|
|
72735
|
-
|
|
72802
|
+
_context4.next = 4;
|
|
72736
72803
|
return playerReportFault('Video file source not supported');
|
|
72737
72804
|
case 4:
|
|
72738
|
-
|
|
72805
|
+
_context4.next = 7;
|
|
72739
72806
|
break;
|
|
72740
72807
|
case 6:
|
|
72741
72808
|
// End media after 5 seconds
|
|
72742
72809
|
setTimeout(function () {
|
|
72743
72810
|
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
|
|
72744
|
-
|
|
72745
|
-
vjsPlayer.dispose();
|
|
72811
|
+
videoMediaInstance.stop();
|
|
72746
72812
|
}, 5000);
|
|
72747
72813
|
case 7:
|
|
72748
72814
|
case "end":
|
|
72749
|
-
return
|
|
72815
|
+
return _context4.stop();
|
|
72750
72816
|
}
|
|
72751
|
-
},
|
|
72817
|
+
}, _callee4);
|
|
72752
72818
|
}));
|
|
72753
72819
|
return function (_x3) {
|
|
72754
|
-
return
|
|
72820
|
+
return _ref4.apply(this, arguments);
|
|
72755
72821
|
};
|
|
72756
72822
|
}());
|
|
72757
|
-
|
|
72758
|
-
|
|
72759
|
-
|
|
72760
|
-
|
|
72761
|
-
|
|
72762
|
-
|
|
72763
|
-
|
|
72764
|
-
|
|
72765
|
-
|
|
72766
|
-
|
|
72767
|
-
|
|
72768
|
-
|
|
72769
|
-
|
|
72770
|
-
|
|
72823
|
+
if (media.duration === 0) {
|
|
72824
|
+
vjsPlayer.on('ended', function () {
|
|
72825
|
+
console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72826
|
+
videoMediaInstance.stop();
|
|
72827
|
+
});
|
|
72828
|
+
vjsPlayer.on('durationchange', function () {
|
|
72829
|
+
console.debug('VIDEOJS: ondurationchange: Showing Media ' + media.id + ' for ' + vjsPlayer.duration() + 's of Region ' + media.region.regionId);
|
|
72830
|
+
});
|
|
72831
|
+
}
|
|
72832
|
+
}
|
|
72833
|
+
},
|
|
72834
|
+
stop: function stop() {
|
|
72835
|
+
var disposeOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
72836
|
+
var vjsPlayer = media.player;
|
|
72837
|
+
// Expire the media and dispose the video
|
|
72838
|
+
if (vjsPlayer !== undefined) {
|
|
72839
|
+
if (!disposeOnly) {
|
|
72840
|
+
media.emitter.emit('end', media);
|
|
72841
|
+
}
|
|
72842
|
+
vjsPlayer.dispose();
|
|
72771
72843
|
}
|
|
72772
72844
|
}
|
|
72773
72845
|
};
|
|
72846
|
+
return videoMediaInstance;
|
|
72774
72847
|
}
|
|
72775
72848
|
|
|
72776
72849
|
function AudioMedia(media) {
|
|
@@ -72850,6 +72923,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72850
72923
|
if (mediaTimeCount > media.duration) {
|
|
72851
72924
|
console.debug('startMediaTimer: emit>end: on media ' + media.id + ' of Region ' + media.region.regionId);
|
|
72852
72925
|
media.emitter.emit('end', media);
|
|
72926
|
+
if (media.mediaType === 'video') {
|
|
72927
|
+
// Dispose the video media
|
|
72928
|
+
console.debug("VideoMedia::stop - ".concat(capitalizeStr(media.mediaType), " for media ").concat(media.id, " has been stopped."));
|
|
72929
|
+
VideoMedia(media, xlr).stop(true);
|
|
72930
|
+
}
|
|
72853
72931
|
}
|
|
72854
72932
|
}, 1000);
|
|
72855
72933
|
console.debug('startMediaTimer: Showing Media ' + media.id + ' for ' + media.duration + 's of Region ' + media.region.regionId);
|
|
@@ -74654,15 +74732,22 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74654
74732
|
exports.VideoMedia = VideoMedia;
|
|
74655
74733
|
exports.audioFileType = audioFileType;
|
|
74656
74734
|
exports.capitalizeStr = capitalizeStr;
|
|
74735
|
+
exports.composeBgUrlByPlatform = composeBgUrlByPlatform;
|
|
74736
|
+
exports.composeMediaUrl = composeMediaUrl;
|
|
74737
|
+
exports.composeResourceUrl = composeResourceUrl;
|
|
74738
|
+
exports.composeResourceUrlByPlatform = composeResourceUrlByPlatform;
|
|
74657
74739
|
exports.default = XiboLayoutRenderer;
|
|
74658
74740
|
exports.defaultTrans = defaultTrans;
|
|
74659
74741
|
exports.fadeInElem = fadeInElem;
|
|
74660
74742
|
exports.fadeOutElem = fadeOutElem;
|
|
74661
74743
|
exports.fetchJSON = fetchJSON;
|
|
74744
|
+
exports.fetchText = fetchText;
|
|
74662
74745
|
exports.flyInElem = flyInElem;
|
|
74663
74746
|
exports.flyOutElem = flyOutElem;
|
|
74664
74747
|
exports.flyTransitionKeyframes = flyTransitionKeyframes;
|
|
74748
|
+
exports.getDataBlob = getDataBlob;
|
|
74665
74749
|
exports.getFileExt = getFileExt;
|
|
74750
|
+
exports.getIndexByLayoutId = getIndexByLayoutId;
|
|
74666
74751
|
exports.getLayout = getLayout;
|
|
74667
74752
|
exports.getMediaId = getMediaId;
|
|
74668
74753
|
exports.getXlf = getXlf;
|
|
@@ -74671,6 +74756,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74671
74756
|
exports.initialMedia = initialMedia;
|
|
74672
74757
|
exports.initialRegion = initialRegion;
|
|
74673
74758
|
exports.initialXlr = initialXlr;
|
|
74759
|
+
exports.isEmpty = isEmpty$1;
|
|
74674
74760
|
exports.nextId = nextId;
|
|
74675
74761
|
exports.platform = platform;
|
|
74676
74762
|
exports.preloadMediaBlob = preloadMediaBlob;
|