@xibosignage/xibo-layout-renderer 1.0.15 → 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.
@@ -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,13 +72669,13 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72638
72669
  return $media;
72639
72670
  }
72640
72671
  function VideoMedia(media, xlr) {
72641
- return {
72672
+ var videoMediaInstance = {
72642
72673
  init: function init() {
72643
72674
  var vjsPlayer = media.player;
72644
72675
  if (vjsPlayer !== undefined) {
72645
72676
  var playerReportFault = /*#__PURE__*/function () {
72646
72677
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
72647
- var playerSW, hasSW, endVideo;
72678
+ var playerSW, hasSW;
72648
72679
  return _regeneratorRuntime().wrap(function _callee$(_context) {
72649
72680
  while (1) switch (_context.prev = _context.next) {
72650
72681
  case 0:
@@ -72654,11 +72685,6 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72654
72685
  return playerSW.getSW();
72655
72686
  case 3:
72656
72687
  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
72688
  if (hasSW) {
72663
72689
  playerSW.postMsg({
72664
72690
  type: 'MEDIA_FAULT',
@@ -72671,12 +72697,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72671
72697
  // Temporary setting
72672
72698
  expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
72673
72699
  })["finally"](function () {
72674
- endVideo();
72700
+ videoMediaInstance.stop();
72675
72701
  });
72676
72702
  } else {
72677
- endVideo();
72703
+ videoMediaInstance.stop();
72678
72704
  }
72679
- case 6:
72705
+ case 5:
72680
72706
  case "end":
72681
72707
  return _context.stop();
72682
72708
  }
@@ -72729,28 +72755,26 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72729
72755
  console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
72730
72756
  })["catch"]( /*#__PURE__*/function () {
72731
72757
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
72732
- var _media$emitter;
72733
72758
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
72734
72759
  while (1) switch (_context3.prev = _context3.next) {
72735
72760
  case 0:
72736
72761
  if (!(error === 'Timeout')) {
72737
- _context3.next = 6;
72762
+ _context3.next = 5;
72738
72763
  break;
72739
72764
  }
72740
72765
  console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
72741
- vjsPlayer.dispose();
72742
- (_media$emitter = media.emitter) === null || _media$emitter === void 0 || _media$emitter.emit('end', media);
72743
- _context3.next = 10;
72766
+ videoMediaInstance.stop();
72767
+ _context3.next = 9;
72744
72768
  break;
72745
- case 6:
72769
+ case 5:
72746
72770
  console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
72747
72771
  if (!(xlr.config.platform === 'chromeOS')) {
72748
- _context3.next = 10;
72772
+ _context3.next = 9;
72749
72773
  break;
72750
72774
  }
72751
- _context3.next = 10;
72775
+ _context3.next = 9;
72752
72776
  return playerReportFault('Media autoplay error');
72753
- case 10:
72777
+ case 9:
72754
72778
  case "end":
72755
72779
  return _context3.stop();
72756
72780
  }
@@ -72784,8 +72808,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72784
72808
  // End media after 5 seconds
72785
72809
  setTimeout(function () {
72786
72810
  console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
72787
- media.emitter.emit('end', media);
72788
- vjsPlayer.dispose();
72811
+ videoMediaInstance.stop();
72789
72812
  }, 5000);
72790
72813
  case 7:
72791
72814
  case "end":
@@ -72797,23 +72820,30 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72797
72820
  return _ref4.apply(this, arguments);
72798
72821
  };
72799
72822
  }());
72800
- vjsPlayer.on('ended', function () {
72801
- var _media$emitter2;
72802
- console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
72803
- (_media$emitter2 = media.emitter) === null || _media$emitter2 === void 0 || _media$emitter2.emit('end', media);
72804
- vjsPlayer.dispose();
72805
- });
72806
- vjsPlayer.on('durationchange', function () {
72807
- if (media.duration === 0 && vjsPlayer.duration() !== undefined) {
72808
- media.duration = vjsPlayer.duration();
72809
- } else if (media.duration > 0) {
72810
- vjsPlayer.duration(media.duration);
72811
- }
72812
- console.debug('VIDEOJS: ondurationchange: Showing Media ' + media.id + ' for ' + vjsPlayer.duration() + 's of Region ' + media.region.regionId);
72813
- });
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();
72814
72843
  }
72815
72844
  }
72816
72845
  };
72846
+ return videoMediaInstance;
72817
72847
  }
72818
72848
 
72819
72849
  function AudioMedia(media) {
@@ -72893,6 +72923,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72893
72923
  if (mediaTimeCount > media.duration) {
72894
72924
  console.debug('startMediaTimer: emit>end: on media ' + media.id + ' of Region ' + media.region.regionId);
72895
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
+ }
72896
72931
  }
72897
72932
  }, 1000);
72898
72933
  console.debug('startMediaTimer: Showing Media ' + media.id + ' for ' + media.duration + 's of Region ' + media.region.regionId);
@@ -74697,15 +74732,22 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74697
74732
  exports.VideoMedia = VideoMedia;
74698
74733
  exports.audioFileType = audioFileType;
74699
74734
  exports.capitalizeStr = capitalizeStr;
74735
+ exports.composeBgUrlByPlatform = composeBgUrlByPlatform;
74736
+ exports.composeMediaUrl = composeMediaUrl;
74737
+ exports.composeResourceUrl = composeResourceUrl;
74738
+ exports.composeResourceUrlByPlatform = composeResourceUrlByPlatform;
74700
74739
  exports.default = XiboLayoutRenderer;
74701
74740
  exports.defaultTrans = defaultTrans;
74702
74741
  exports.fadeInElem = fadeInElem;
74703
74742
  exports.fadeOutElem = fadeOutElem;
74704
74743
  exports.fetchJSON = fetchJSON;
74744
+ exports.fetchText = fetchText;
74705
74745
  exports.flyInElem = flyInElem;
74706
74746
  exports.flyOutElem = flyOutElem;
74707
74747
  exports.flyTransitionKeyframes = flyTransitionKeyframes;
74748
+ exports.getDataBlob = getDataBlob;
74708
74749
  exports.getFileExt = getFileExt;
74750
+ exports.getIndexByLayoutId = getIndexByLayoutId;
74709
74751
  exports.getLayout = getLayout;
74710
74752
  exports.getMediaId = getMediaId;
74711
74753
  exports.getXlf = getXlf;
@@ -74714,6 +74756,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74714
74756
  exports.initialMedia = initialMedia;
74715
74757
  exports.initialRegion = initialRegion;
74716
74758
  exports.initialXlr = initialXlr;
74759
+ exports.isEmpty = isEmpty$1;
74717
74760
  exports.nextId = nextId;
74718
74761
  exports.platform = platform;
74719
74762
  exports.preloadMediaBlob = preloadMediaBlob;