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