@xibosignage/xibo-layout-renderer 1.0.15 → 1.0.17
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 +2 -0
- package/dist/xibo-layout-renderer.cjs.js +114 -56
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +20 -1
- package/dist/xibo-layout-renderer.esm.js +107 -57
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +114 -56
- 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 {};
|
|
@@ -72639,12 +72670,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72639
72670
|
}
|
|
72640
72671
|
function VideoMedia(media, xlr) {
|
|
72641
72672
|
return {
|
|
72673
|
+
duration: 0,
|
|
72642
72674
|
init: function init() {
|
|
72675
|
+
var _this = this;
|
|
72643
72676
|
var vjsPlayer = media.player;
|
|
72677
|
+
this.duration = media.duration;
|
|
72644
72678
|
if (vjsPlayer !== undefined) {
|
|
72645
72679
|
var playerReportFault = /*#__PURE__*/function () {
|
|
72646
72680
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
|
|
72647
|
-
var playerSW, hasSW
|
|
72681
|
+
var playerSW, hasSW;
|
|
72648
72682
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72649
72683
|
while (1) switch (_context.prev = _context.next) {
|
|
72650
72684
|
case 0:
|
|
@@ -72654,11 +72688,6 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72654
72688
|
return playerSW.getSW();
|
|
72655
72689
|
case 3:
|
|
72656
72690
|
hasSW = _context.sent;
|
|
72657
|
-
endVideo = function endVideo() {
|
|
72658
|
-
// Expire the media and dispose the video
|
|
72659
|
-
vjsPlayer.dispose();
|
|
72660
|
-
media.emitter.emit('end', media);
|
|
72661
|
-
};
|
|
72662
72691
|
if (hasSW) {
|
|
72663
72692
|
playerSW.postMsg({
|
|
72664
72693
|
type: 'MEDIA_FAULT',
|
|
@@ -72671,12 +72700,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72671
72700
|
// Temporary setting
|
|
72672
72701
|
expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
|
|
72673
72702
|
})["finally"](function () {
|
|
72674
|
-
|
|
72703
|
+
_this.stop();
|
|
72675
72704
|
});
|
|
72676
72705
|
} else {
|
|
72677
|
-
|
|
72706
|
+
_this.stop();
|
|
72678
72707
|
}
|
|
72679
|
-
case
|
|
72708
|
+
case 5:
|
|
72680
72709
|
case "end":
|
|
72681
72710
|
return _context.stop();
|
|
72682
72711
|
}
|
|
@@ -72687,11 +72716,26 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72687
72716
|
};
|
|
72688
72717
|
}();
|
|
72689
72718
|
vjsPlayer.on('loadstart', function () {
|
|
72690
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
|
|
72719
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
|
|
72691
72720
|
});
|
|
72692
|
-
vjsPlayer.
|
|
72693
|
-
|
|
72721
|
+
vjsPlayer.one('loadedmetadata', function () {
|
|
72722
|
+
if (media.duration === 0) {
|
|
72723
|
+
_this.duration = vjsPlayer.duration();
|
|
72724
|
+
}
|
|
72725
|
+
console.debug('VideoMedia: loadedmetadata: Setting video duration to = ' + _this.duration);
|
|
72726
|
+
});
|
|
72727
|
+
vjsPlayer.one('canplay', function () {
|
|
72728
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " can be played . . ."));
|
|
72729
|
+
});
|
|
72730
|
+
vjsPlayer.one('playing', function () {
|
|
72731
|
+
console.debug('VideoMedia: playing: Showing Media ' + media.id + ' for ' + _this.duration + 's of Region ' + media.region.regionId);
|
|
72732
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72694
72733
|
});
|
|
72734
|
+
// @NOTE: When video is paused due to fail in unmuting the video
|
|
72735
|
+
// and video has media.duration = 0, the video will stay paused and the video cycle won't end
|
|
72736
|
+
// @TODO: Add timer when video is paused due to unmuting fail and duration that is equal to 0
|
|
72737
|
+
// @NOTE: The pause issue when unmuting the video is mainly on a browser level.
|
|
72738
|
+
// Please visit https://developer.chrome.com/blog/autoplay/ for more info.
|
|
72695
72739
|
vjsPlayer.on('ready', function () {
|
|
72696
72740
|
vjsPlayer.muted(true);
|
|
72697
72741
|
// Race promise between a 0.5s play and a 5s skip
|
|
@@ -72700,57 +72744,57 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72700
72744
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
72701
72745
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72702
72746
|
case 0:
|
|
72703
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72747
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72704
72748
|
// Try to force play here
|
|
72705
72749
|
_context2.prev = 1;
|
|
72706
|
-
|
|
72750
|
+
// Set video mute/unmute based on setting once playing
|
|
72751
|
+
vjsPlayer.muted(media.muted);
|
|
72752
|
+
_context2.next = 5;
|
|
72707
72753
|
return vjsPlayer.play();
|
|
72708
|
-
case
|
|
72754
|
+
case 5:
|
|
72709
72755
|
// Resolve if play works
|
|
72710
72756
|
resolve(true);
|
|
72711
|
-
_context2.next =
|
|
72757
|
+
_context2.next = 11;
|
|
72712
72758
|
break;
|
|
72713
|
-
case
|
|
72714
|
-
_context2.prev =
|
|
72759
|
+
case 8:
|
|
72760
|
+
_context2.prev = 8;
|
|
72715
72761
|
_context2.t0 = _context2["catch"](1);
|
|
72716
72762
|
// Reject race if play fails
|
|
72717
72763
|
reject('Play failed');
|
|
72718
|
-
case
|
|
72764
|
+
case 11:
|
|
72719
72765
|
case "end":
|
|
72720
72766
|
return _context2.stop();
|
|
72721
72767
|
}
|
|
72722
|
-
}, _callee2, null, [[1,
|
|
72768
|
+
}, _callee2, null, [[1, 8]]);
|
|
72723
72769
|
})), 100);
|
|
72724
72770
|
}), new Promise(function (_, reject) {
|
|
72725
72771
|
return setTimeout(function () {
|
|
72726
72772
|
return reject('Timeout');
|
|
72727
72773
|
}, 5000);
|
|
72728
72774
|
})]).then(function () {
|
|
72729
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72775
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72730
72776
|
})["catch"]( /*#__PURE__*/function () {
|
|
72731
72777
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
|
|
72732
|
-
var _media$emitter;
|
|
72733
72778
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
72734
72779
|
while (1) switch (_context3.prev = _context3.next) {
|
|
72735
72780
|
case 0:
|
|
72736
72781
|
if (!(error === 'Timeout')) {
|
|
72737
|
-
_context3.next =
|
|
72782
|
+
_context3.next = 5;
|
|
72738
72783
|
break;
|
|
72739
72784
|
}
|
|
72740
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72741
|
-
|
|
72742
|
-
|
|
72743
|
-
_context3.next = 10;
|
|
72785
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72786
|
+
_this.stop();
|
|
72787
|
+
_context3.next = 9;
|
|
72744
72788
|
break;
|
|
72745
|
-
case
|
|
72746
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72789
|
+
case 5:
|
|
72790
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72747
72791
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72748
|
-
_context3.next =
|
|
72792
|
+
_context3.next = 9;
|
|
72749
72793
|
break;
|
|
72750
72794
|
}
|
|
72751
|
-
_context3.next =
|
|
72795
|
+
_context3.next = 9;
|
|
72752
72796
|
return playerReportFault('Media autoplay error');
|
|
72753
|
-
case
|
|
72797
|
+
case 9:
|
|
72754
72798
|
case "end":
|
|
72755
72799
|
return _context3.stop();
|
|
72756
72800
|
}
|
|
@@ -72761,16 +72805,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72761
72805
|
};
|
|
72762
72806
|
}());
|
|
72763
72807
|
});
|
|
72764
|
-
vjsPlayer.on('playing', function () {
|
|
72765
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72766
|
-
vjsPlayer.muted(media.muted);
|
|
72767
|
-
});
|
|
72768
72808
|
vjsPlayer.on('error', /*#__PURE__*/function () {
|
|
72769
72809
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
|
|
72770
72810
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
72771
72811
|
while (1) switch (_context4.prev = _context4.next) {
|
|
72772
72812
|
case 0:
|
|
72773
|
-
console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72813
|
+
console.debug("VideoMedia: Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72774
72814
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72775
72815
|
_context4.next = 6;
|
|
72776
72816
|
break;
|
|
@@ -72783,9 +72823,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72783
72823
|
case 6:
|
|
72784
72824
|
// End media after 5 seconds
|
|
72785
72825
|
setTimeout(function () {
|
|
72786
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
|
|
72787
|
-
|
|
72788
|
-
vjsPlayer.dispose();
|
|
72826
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
|
|
72827
|
+
_this.stop();
|
|
72789
72828
|
}, 5000);
|
|
72790
72829
|
case 7:
|
|
72791
72830
|
case "end":
|
|
@@ -72797,20 +72836,25 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72797
72836
|
return _ref4.apply(this, arguments);
|
|
72798
72837
|
};
|
|
72799
72838
|
}());
|
|
72800
|
-
|
|
72801
|
-
|
|
72802
|
-
|
|
72803
|
-
|
|
72804
|
-
|
|
72805
|
-
}
|
|
72806
|
-
|
|
72807
|
-
|
|
72808
|
-
|
|
72809
|
-
|
|
72810
|
-
|
|
72811
|
-
|
|
72812
|
-
|
|
72813
|
-
|
|
72839
|
+
if (media.duration === 0) {
|
|
72840
|
+
vjsPlayer.on('ended', function () {
|
|
72841
|
+
console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72842
|
+
_this.stop();
|
|
72843
|
+
});
|
|
72844
|
+
}
|
|
72845
|
+
}
|
|
72846
|
+
},
|
|
72847
|
+
stop: function stop() {
|
|
72848
|
+
var disposeOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
72849
|
+
var vjsPlayer = media.player;
|
|
72850
|
+
// Expire the media and dispose the video
|
|
72851
|
+
if (vjsPlayer !== undefined) {
|
|
72852
|
+
if (!disposeOnly) {
|
|
72853
|
+
media.emitter.emit('end', media);
|
|
72854
|
+
}
|
|
72855
|
+
vjsPlayer.dispose();
|
|
72856
|
+
// Clear up media player
|
|
72857
|
+
media.player = undefined;
|
|
72814
72858
|
}
|
|
72815
72859
|
}
|
|
72816
72860
|
};
|
|
@@ -72893,13 +72937,19 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72893
72937
|
if (mediaTimeCount > media.duration) {
|
|
72894
72938
|
console.debug('startMediaTimer: emit>end: on media ' + media.id + ' of Region ' + media.region.regionId);
|
|
72895
72939
|
media.emitter.emit('end', media);
|
|
72940
|
+
if (media.mediaType === 'video') {
|
|
72941
|
+
// Dispose the video media
|
|
72942
|
+
console.debug("VideoMedia::stop - ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72943
|
+
VideoMedia(media, xlr).stop(true);
|
|
72944
|
+
}
|
|
72896
72945
|
}
|
|
72897
72946
|
}, 1000);
|
|
72898
72947
|
console.debug('startMediaTimer: Showing Media ' + media.id + ' for ' + media.duration + 's of Region ' + media.region.regionId);
|
|
72899
72948
|
};
|
|
72900
72949
|
emitter.on('start', function (media) {
|
|
72901
72950
|
if (media.mediaType === 'video') {
|
|
72902
|
-
VideoMedia(media, xlr)
|
|
72951
|
+
var videoMedia = VideoMedia(media, xlr);
|
|
72952
|
+
videoMedia.init();
|
|
72903
72953
|
if (media.duration > 0) {
|
|
72904
72954
|
startMediaTimer(media);
|
|
72905
72955
|
}
|
|
@@ -73220,7 +73270,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73220
73270
|
controls: false,
|
|
73221
73271
|
preload: 'auto',
|
|
73222
73272
|
autoplay: false,
|
|
73223
|
-
muted:
|
|
73273
|
+
muted: true,
|
|
73224
73274
|
errorDisplay: xlr.config.platform !== 'chromeOS',
|
|
73225
73275
|
loop: self.loop
|
|
73226
73276
|
});
|
|
@@ -74697,15 +74747,22 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74697
74747
|
exports.VideoMedia = VideoMedia;
|
|
74698
74748
|
exports.audioFileType = audioFileType;
|
|
74699
74749
|
exports.capitalizeStr = capitalizeStr;
|
|
74750
|
+
exports.composeBgUrlByPlatform = composeBgUrlByPlatform;
|
|
74751
|
+
exports.composeMediaUrl = composeMediaUrl;
|
|
74752
|
+
exports.composeResourceUrl = composeResourceUrl;
|
|
74753
|
+
exports.composeResourceUrlByPlatform = composeResourceUrlByPlatform;
|
|
74700
74754
|
exports.default = XiboLayoutRenderer;
|
|
74701
74755
|
exports.defaultTrans = defaultTrans;
|
|
74702
74756
|
exports.fadeInElem = fadeInElem;
|
|
74703
74757
|
exports.fadeOutElem = fadeOutElem;
|
|
74704
74758
|
exports.fetchJSON = fetchJSON;
|
|
74759
|
+
exports.fetchText = fetchText;
|
|
74705
74760
|
exports.flyInElem = flyInElem;
|
|
74706
74761
|
exports.flyOutElem = flyOutElem;
|
|
74707
74762
|
exports.flyTransitionKeyframes = flyTransitionKeyframes;
|
|
74763
|
+
exports.getDataBlob = getDataBlob;
|
|
74708
74764
|
exports.getFileExt = getFileExt;
|
|
74765
|
+
exports.getIndexByLayoutId = getIndexByLayoutId;
|
|
74709
74766
|
exports.getLayout = getLayout;
|
|
74710
74767
|
exports.getMediaId = getMediaId;
|
|
74711
74768
|
exports.getXlf = getXlf;
|
|
@@ -74714,6 +74771,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
74714
74771
|
exports.initialMedia = initialMedia;
|
|
74715
74772
|
exports.initialRegion = initialRegion;
|
|
74716
74773
|
exports.initialXlr = initialXlr;
|
|
74774
|
+
exports.isEmpty = isEmpty$1;
|
|
74717
74775
|
exports.nextId = nextId;
|
|
74718
74776
|
exports.platform = platform;
|
|
74719
74777
|
exports.preloadMediaBlob = preloadMediaBlob;
|