@xibosignage/xibo-layout-renderer 1.0.10 → 1.0.12

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.
@@ -849,7 +849,9 @@ var XiboLayoutRenderer = (function (exports) {
849
849
  function composeBgUrlByPlatform(platform, params) {
850
850
  var bgImageUrl = params.layoutBackgroundDownloadUrl.replace(":id", params.layout.id) + '?preview=1&width=' + params.layout.sWidth + '&height=' + params.layout.sHeight + '&dynamic&proportional=0';
851
851
  if (platform === 'chromeOS') {
852
- bgImageUrl = '/required-files/resource/' + params.layout.id + '?saveAs=' + params.layout.bgImage;
852
+ bgImageUrl = composeMediaUrl({
853
+ uri: params.layout.bgImage
854
+ });
853
855
  }
854
856
  return bgImageUrl;
855
857
  }
@@ -69558,7 +69560,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
69558
69560
  return {};
69559
69561
  },
69560
69562
  emitter: {},
69561
- enableStat: false
69563
+ enableStat: false,
69564
+ muted: false
69562
69565
  };
69563
69566
 
69564
69567
  /*
@@ -72625,15 +72628,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72625
72628
  return _composeVideoSource.apply(this, arguments);
72626
72629
  }
72627
72630
  function _composeVideoSource() {
72628
- _composeVideoSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2($media, media) {
72631
+ _composeVideoSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4($media, media) {
72629
72632
  var videoSrc, vidType, $videoSource;
72630
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72631
- while (1) switch (_context2.prev = _context2.next) {
72633
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
72634
+ while (1) switch (_context4.prev = _context4.next) {
72632
72635
  case 0:
72633
- _context2.next = 2;
72636
+ _context4.next = 2;
72634
72637
  return preloadMediaBlob(media.url, media.mediaType);
72635
72638
  case 2:
72636
- videoSrc = _context2.sent;
72639
+ videoSrc = _context4.sent;
72637
72640
  vidType = videoFileType(getFileExt(media.uri)); // Only add one source per type
72638
72641
  if ($media.querySelectorAll("source[type=\"".concat(vidType, "\"]")).length === 0) {
72639
72642
  $videoSource = document.createElement('source');
@@ -72641,12 +72644,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72641
72644
  $videoSource.type = vidType;
72642
72645
  $media.insertBefore($videoSource, $media.lastElementChild);
72643
72646
  }
72644
- return _context2.abrupt("return", $media);
72647
+ return _context4.abrupt("return", $media);
72645
72648
  case 6:
72646
72649
  case "end":
72647
- return _context2.stop();
72650
+ return _context4.stop();
72648
72651
  }
72649
- }, _callee2);
72652
+ }, _callee4);
72650
72653
  }));
72651
72654
  return _composeVideoSource.apply(this, arguments);
72652
72655
  }
@@ -72656,87 +72659,130 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72656
72659
  var $videoMedia = document.getElementById(getMediaId(media));
72657
72660
  if ($videoMedia) {
72658
72661
  var vjsPlayer = videojs.getPlayer($videoMedia);
72659
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('loadstart', function () {
72660
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
72661
- });
72662
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('loadstart', function () {
72663
- if ($videoMedia.readyState >= 2) {
72664
- console.debug("".concat(capitalizeStr(media.mediaType), " data for media > ").concat(media.id, " has been fully loaded . . ."));
72665
- }
72666
- });
72667
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('canplay', function () {
72668
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " can be played . . ."));
72669
- // Autoplay restarted
72670
- console.debug('autoplay started . . .');
72671
- vjsPlayer.muted(true);
72672
- vjsPlayer.play();
72673
- });
72674
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('playing', function () {
72675
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
72676
- });
72677
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('error', /*#__PURE__*/function () {
72678
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err) {
72679
- var playerSW, hasSW;
72680
- return _regeneratorRuntime().wrap(function _callee$(_context) {
72681
- while (1) switch (_context.prev = _context.next) {
72682
- case 0:
72683
- console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
72684
- if (!(xlr.config.platform === 'chromeOS')) {
72685
- _context.next = 9;
72686
- break;
72687
- }
72688
- // Immediately expire media and report a fault
72689
- playerSW = PwaSW();
72690
- _context.next = 5;
72691
- return playerSW.getSW();
72692
- case 5:
72693
- hasSW = _context.sent;
72694
- if (hasSW) {
72695
- playerSW.postMsg({
72696
- type: 'MEDIA_FAULT',
72697
- code: 5002,
72698
- reason: 'Video file source not supported',
72699
- mediaId: media.id,
72700
- regionId: media.region.id,
72701
- layoutId: media.region.layout.id,
72702
- date: format(new Date(), 'yyyy-MM-dd HH:mm:ss'),
72703
- // Temporary setting
72704
- expires: format(new Date(setExpiry(7)), 'yyyy-MM-dd HH:mm:ss')
72705
- })["finally"](function () {
72706
- // Expire the media and dispose the video
72707
- vjsPlayer.dispose();
72708
- media.emitter.emit('end', media);
72709
- });
72710
- }
72711
- _context.next = 10;
72712
- break;
72713
- case 9:
72714
- // End media after 5 seconds
72715
- setTimeout(function () {
72716
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
72717
- media.emitter.emit('end', media);
72718
- vjsPlayer.dispose();
72719
- }, 5000);
72720
- case 10:
72721
- case "end":
72722
- return _context.stop();
72723
- }
72724
- }, _callee);
72725
- }));
72726
- return function (_x3) {
72727
- return _ref.apply(this, arguments);
72728
- };
72729
- }());
72730
- if (media.duration === 0) {
72731
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('durationchange', function () {
72732
- console.debug('Showing Media ' + media.id + ' for ' + vjsPlayer.duration() + 's of Region ' + media.region.regionId);
72662
+ if (vjsPlayer !== undefined) {
72663
+ var playerReportFault = /*#__PURE__*/function () {
72664
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
72665
+ var playerSW, hasSW;
72666
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
72667
+ while (1) switch (_context.prev = _context.next) {
72668
+ case 0:
72669
+ // Immediately expire media and report a fault
72670
+ playerSW = PwaSW();
72671
+ _context.next = 3;
72672
+ return playerSW.getSW();
72673
+ case 3:
72674
+ hasSW = _context.sent;
72675
+ if (hasSW) {
72676
+ playerSW.postMsg({
72677
+ type: 'MEDIA_FAULT',
72678
+ code: 5002,
72679
+ reason: msg,
72680
+ mediaId: media.id,
72681
+ regionId: media.region.id,
72682
+ layoutId: media.region.layout.id,
72683
+ date: format(new Date(), 'yyyy-MM-dd HH:mm:ss'),
72684
+ // Temporary setting
72685
+ expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
72686
+ })["finally"](function () {
72687
+ // Expire the media and dispose the video
72688
+ vjsPlayer.dispose();
72689
+ media.emitter.emit('end', media);
72690
+ });
72691
+ }
72692
+ case 5:
72693
+ case "end":
72694
+ return _context.stop();
72695
+ }
72696
+ }, _callee);
72697
+ }));
72698
+ return function playerReportFault(_x3) {
72699
+ return _ref.apply(this, arguments);
72700
+ };
72701
+ }();
72702
+ vjsPlayer.on('loadstart', function () {
72703
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
72733
72704
  });
72734
- vjsPlayer === null || vjsPlayer === void 0 || vjsPlayer.on('ended', function () {
72735
- var _media$emitter;
72736
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
72737
- (_media$emitter = media.emitter) === null || _media$emitter === void 0 || _media$emitter.emit('end', media);
72738
- vjsPlayer.dispose();
72705
+ vjsPlayer.on('canplay', function () {
72706
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " can be played . . ."));
72739
72707
  });
72708
+ vjsPlayer.ready(function () {
72709
+ var promise = vjsPlayer.play();
72710
+ if (promise !== undefined) {
72711
+ promise.then(function () {
72712
+ // Autoplay restarted
72713
+ console.debug('autoplay started . . .');
72714
+ vjsPlayer.muted(true);
72715
+ })["catch"]( /*#__PURE__*/function () {
72716
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
72717
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72718
+ while (1) switch (_context2.prev = _context2.next) {
72719
+ case 0:
72720
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " autoplay error"));
72721
+ if (!(xlr.config.platform === 'chromeOS')) {
72722
+ _context2.next = 4;
72723
+ break;
72724
+ }
72725
+ _context2.next = 4;
72726
+ return playerReportFault('Media autoplay error');
72727
+ case 4:
72728
+ case "end":
72729
+ return _context2.stop();
72730
+ }
72731
+ }, _callee2);
72732
+ }));
72733
+ return function (_x4) {
72734
+ return _ref2.apply(this, arguments);
72735
+ };
72736
+ }());
72737
+ }
72738
+ });
72739
+ vjsPlayer.on('playing', function () {
72740
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
72741
+ vjsPlayer.muted(media.muted);
72742
+ });
72743
+ vjsPlayer.on('error', /*#__PURE__*/function () {
72744
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err) {
72745
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
72746
+ while (1) switch (_context3.prev = _context3.next) {
72747
+ case 0:
72748
+ console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
72749
+ if (!(xlr.config.platform === 'chromeOS')) {
72750
+ _context3.next = 6;
72751
+ break;
72752
+ }
72753
+ _context3.next = 4;
72754
+ return playerReportFault('Video file source not supported');
72755
+ case 4:
72756
+ _context3.next = 7;
72757
+ break;
72758
+ case 6:
72759
+ // End media after 5 seconds
72760
+ setTimeout(function () {
72761
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
72762
+ media.emitter.emit('end', media);
72763
+ vjsPlayer.dispose();
72764
+ }, 5000);
72765
+ case 7:
72766
+ case "end":
72767
+ return _context3.stop();
72768
+ }
72769
+ }, _callee3);
72770
+ }));
72771
+ return function (_x5) {
72772
+ return _ref3.apply(this, arguments);
72773
+ };
72774
+ }());
72775
+ if (media.duration === 0) {
72776
+ vjsPlayer.on('durationchange', function () {
72777
+ console.debug('Showing Media ' + media.id + ' for ' + vjsPlayer.duration() + 's of Region ' + media.region.regionId);
72778
+ });
72779
+ vjsPlayer.on('ended', function () {
72780
+ var _media$emitter;
72781
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
72782
+ vjsPlayer.dispose();
72783
+ (_media$emitter = media.emitter) === null || _media$emitter === void 0 || _media$emitter.emit('end', media);
72784
+ });
72785
+ }
72740
72786
  }
72741
72787
  }
72742
72788
  }
@@ -72949,7 +72995,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72949
72995
  tmpUrl = composeResourceUrlByPlatform(xlr.config, resourceUrlParams);
72950
72996
  } else if (xlr.config.platform === 'chromeOS') {
72951
72997
  tmpUrl = composeResourceUrl(xlr.config, resourceUrlParams);
72952
- if (self.mediaType === 'image' || self.mediaType === 'video') {
72998
+ if (self.mediaType === 'image' || self.mediaType === 'video' || self.mediaType === 'audio') {
72953
72999
  tmpUrl = composeMediaUrl(resourceUrlParams);
72954
73000
  }
72955
73001
  }
@@ -73100,7 +73146,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
73100
73146
  $media = getNewMedia();
73101
73147
  }
73102
73148
  if (!$media) {
73103
- _context2.next = 44;
73149
+ _context2.next = 45;
73104
73150
  break;
73105
73151
  }
73106
73152
  $media.style.setProperty('display', 'block');
@@ -73129,11 +73175,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
73129
73175
  _context2.t3 = _context2.t2;
73130
73176
  _context2.t4 = _context2.t1.concat.call(_context2.t1, _context2.t3);
73131
73177
  _context2.t0.setProperty.call(_context2.t0, 'background-image', _context2.t4);
73132
- _context2.next = 43;
73178
+ _context2.next = 44;
73133
73179
  break;
73134
73180
  case 22:
73135
73181
  if (!(self.mediaType === 'video' && self.url !== null)) {
73136
- _context2.next = 31;
73182
+ _context2.next = 32;
73137
73183
  break;
73138
73184
  }
73139
73185
  _context2.next = 25;
@@ -73144,37 +73190,39 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
73144
73190
  if (Boolean(self.options['mute'])) {
73145
73191
  isMuted = self.options.mute === '1';
73146
73192
  }
73193
+ self.muted = isMuted;
73147
73194
  videojs($media, {
73148
73195
  controls: false,
73149
73196
  preload: 'auto',
73150
73197
  autoplay: false,
73151
73198
  muted: isMuted,
73152
- errorDisplay: xlr.config.platform !== 'chromeOS'
73199
+ errorDisplay: xlr.config.platform !== 'chromeOS',
73200
+ restoreEl: $media
73153
73201
  });
73154
- _context2.next = 43;
73202
+ _context2.next = 44;
73155
73203
  break;
73156
- case 31:
73204
+ case 32:
73157
73205
  if (!(self.mediaType === 'audio' && self.url !== null)) {
73158
- _context2.next = 42;
73206
+ _context2.next = 43;
73159
73207
  break;
73160
73208
  }
73161
73209
  if (!isCMS) {
73162
- _context2.next = 38;
73210
+ _context2.next = 39;
73163
73211
  break;
73164
73212
  }
73165
- _context2.next = 35;
73213
+ _context2.next = 36;
73166
73214
  return preloadMediaBlob(self.url, self.mediaType);
73167
- case 35:
73215
+ case 36:
73168
73216
  _context2.t5 = _context2.sent;
73169
- _context2.next = 39;
73217
+ _context2.next = 40;
73170
73218
  break;
73171
- case 38:
73172
- _context2.t5 = self.url;
73173
73219
  case 39:
73220
+ _context2.t5 = self.url;
73221
+ case 40:
73174
73222
  $media.src = _context2.t5;
73175
- _context2.next = 43;
73223
+ _context2.next = 44;
73176
73224
  break;
73177
- case 42:
73225
+ case 43:
73178
73226
  if ((self.render === 'html' || self.mediaType === 'webpage') && self.iframe && self.checkIframeStatus) {
73179
73227
  // Set state as false ( for now )
73180
73228
  self.ready = false;
@@ -73190,9 +73238,9 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
73190
73238
  // }
73191
73239
  // });
73192
73240
  }
73193
- case 43:
73194
- self.emitter.emit('start', self);
73195
73241
  case 44:
73242
+ self.emitter.emit('start', self);
73243
+ case 45:
73196
73244
  case "end":
73197
73245
  return _context2.stop();
73198
73246
  }