@xibosignage/xibo-layout-renderer 1.0.14 → 1.0.15

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.
@@ -72644,7 +72644,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72644
72644
  if (vjsPlayer !== undefined) {
72645
72645
  var playerReportFault = /*#__PURE__*/function () {
72646
72646
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
72647
- var playerSW, hasSW;
72647
+ var playerSW, hasSW, endVideo;
72648
72648
  return _regeneratorRuntime().wrap(function _callee$(_context) {
72649
72649
  while (1) switch (_context.prev = _context.next) {
72650
72650
  case 0:
@@ -72654,6 +72654,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72654
72654
  return playerSW.getSW();
72655
72655
  case 3:
72656
72656
  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
+ };
72657
72662
  if (hasSW) {
72658
72663
  playerSW.postMsg({
72659
72664
  type: 'MEDIA_FAULT',
@@ -72666,12 +72671,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72666
72671
  // Temporary setting
72667
72672
  expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
72668
72673
  })["finally"](function () {
72669
- // Expire the media and dispose the video
72670
- vjsPlayer.dispose();
72671
- media.emitter.emit('end', media);
72674
+ endVideo();
72672
72675
  });
72676
+ } else {
72677
+ endVideo();
72673
72678
  }
72674
- case 5:
72679
+ case 6:
72675
72680
  case "end":
72676
72681
  return _context.stop();
72677
72682
  }
@@ -72689,53 +72694,91 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72689
72694
  });
72690
72695
  vjsPlayer.on('ready', function () {
72691
72696
  vjsPlayer.muted(true);
72692
- var promise = vjsPlayer.play();
72693
- if (promise !== undefined) {
72694
- promise.then(function () {
72695
- // Autoplay restarted
72696
- console.debug('autoplay started . . .');
72697
- })["catch"]( /*#__PURE__*/function () {
72698
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
72699
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72700
- while (1) switch (_context2.prev = _context2.next) {
72701
- case 0:
72702
- console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " autoplay error"));
72703
- if (!(xlr.config.platform === 'chromeOS')) {
72704
- _context2.next = 4;
72705
- break;
72706
- }
72707
- _context2.next = 4;
72708
- return playerReportFault('Media autoplay error');
72709
- case 4:
72710
- case "end":
72711
- return _context2.stop();
72712
- }
72713
- }, _callee2);
72714
- }));
72715
- return function (_x2) {
72716
- return _ref2.apply(this, arguments);
72717
- };
72718
- }());
72719
- }
72697
+ // Race promise between a 0.5s play and a 5s skip
72698
+ Promise.race([new Promise(function (resolve, reject) {
72699
+ return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
72700
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72701
+ while (1) switch (_context2.prev = _context2.next) {
72702
+ case 0:
72703
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
72704
+ // Try to force play here
72705
+ _context2.prev = 1;
72706
+ _context2.next = 4;
72707
+ return vjsPlayer.play();
72708
+ case 4:
72709
+ // Resolve if play works
72710
+ resolve(true);
72711
+ _context2.next = 10;
72712
+ break;
72713
+ case 7:
72714
+ _context2.prev = 7;
72715
+ _context2.t0 = _context2["catch"](1);
72716
+ // Reject race if play fails
72717
+ reject('Play failed');
72718
+ case 10:
72719
+ case "end":
72720
+ return _context2.stop();
72721
+ }
72722
+ }, _callee2, null, [[1, 7]]);
72723
+ })), 100);
72724
+ }), new Promise(function (_, reject) {
72725
+ return setTimeout(function () {
72726
+ return reject('Timeout');
72727
+ }, 5000);
72728
+ })]).then(function () {
72729
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
72730
+ })["catch"]( /*#__PURE__*/function () {
72731
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
72732
+ var _media$emitter;
72733
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
72734
+ while (1) switch (_context3.prev = _context3.next) {
72735
+ case 0:
72736
+ if (!(error === 'Timeout')) {
72737
+ _context3.next = 6;
72738
+ break;
72739
+ }
72740
+ 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;
72744
+ break;
72745
+ case 6:
72746
+ console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
72747
+ if (!(xlr.config.platform === 'chromeOS')) {
72748
+ _context3.next = 10;
72749
+ break;
72750
+ }
72751
+ _context3.next = 10;
72752
+ return playerReportFault('Media autoplay error');
72753
+ case 10:
72754
+ case "end":
72755
+ return _context3.stop();
72756
+ }
72757
+ }, _callee3);
72758
+ }));
72759
+ return function (_x2) {
72760
+ return _ref3.apply(this, arguments);
72761
+ };
72762
+ }());
72720
72763
  });
72721
72764
  vjsPlayer.on('playing', function () {
72722
72765
  console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
72723
72766
  vjsPlayer.muted(media.muted);
72724
72767
  });
72725
72768
  vjsPlayer.on('error', /*#__PURE__*/function () {
72726
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err) {
72727
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
72728
- while (1) switch (_context3.prev = _context3.next) {
72769
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
72770
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
72771
+ while (1) switch (_context4.prev = _context4.next) {
72729
72772
  case 0:
72730
72773
  console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
72731
72774
  if (!(xlr.config.platform === 'chromeOS')) {
72732
- _context3.next = 6;
72775
+ _context4.next = 6;
72733
72776
  break;
72734
72777
  }
72735
- _context3.next = 4;
72778
+ _context4.next = 4;
72736
72779
  return playerReportFault('Video file source not supported');
72737
72780
  case 4:
72738
- _context3.next = 7;
72781
+ _context4.next = 7;
72739
72782
  break;
72740
72783
  case 6:
72741
72784
  // End media after 5 seconds
@@ -72746,18 +72789,18 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72746
72789
  }, 5000);
72747
72790
  case 7:
72748
72791
  case "end":
72749
- return _context3.stop();
72792
+ return _context4.stop();
72750
72793
  }
72751
- }, _callee3);
72794
+ }, _callee4);
72752
72795
  }));
72753
72796
  return function (_x3) {
72754
- return _ref3.apply(this, arguments);
72797
+ return _ref4.apply(this, arguments);
72755
72798
  };
72756
72799
  }());
72757
72800
  vjsPlayer.on('ended', function () {
72758
- var _media$emitter;
72801
+ var _media$emitter2;
72759
72802
  console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
72760
- (_media$emitter = media.emitter) === null || _media$emitter === void 0 || _media$emitter.emit('end', media);
72803
+ (_media$emitter2 = media.emitter) === null || _media$emitter2 === void 0 || _media$emitter2.emit('end', media);
72761
72804
  vjsPlayer.dispose();
72762
72805
  });
72763
72806
  vjsPlayer.on('durationchange', function () {