@xibosignage/xibo-layout-renderer 1.0.13 → 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.
- package/dist/src/Modules/Media/VideoMedia.d.ts +1 -0
- package/dist/styles.css +5 -0
- package/dist/xibo-layout-renderer.cjs.js +108 -66
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.esm.js +108 -66
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +108 -66
- package/dist/xibo-layout-renderer.min.js +1 -1
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -72641,7 +72641,7 @@ function VideoMedia(media, xlr) {
|
|
|
72641
72641
|
if (vjsPlayer !== undefined) {
|
|
72642
72642
|
var playerReportFault = /*#__PURE__*/function () {
|
|
72643
72643
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
|
|
72644
|
-
var playerSW, hasSW;
|
|
72644
|
+
var playerSW, hasSW, endVideo;
|
|
72645
72645
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72646
72646
|
while (1) switch (_context.prev = _context.next) {
|
|
72647
72647
|
case 0:
|
|
@@ -72651,6 +72651,11 @@ function VideoMedia(media, xlr) {
|
|
|
72651
72651
|
return playerSW.getSW();
|
|
72652
72652
|
case 3:
|
|
72653
72653
|
hasSW = _context.sent;
|
|
72654
|
+
endVideo = function endVideo() {
|
|
72655
|
+
// Expire the media and dispose the video
|
|
72656
|
+
vjsPlayer.dispose();
|
|
72657
|
+
media.emitter.emit('end', media);
|
|
72658
|
+
};
|
|
72654
72659
|
if (hasSW) {
|
|
72655
72660
|
playerSW.postMsg({
|
|
72656
72661
|
type: 'MEDIA_FAULT',
|
|
@@ -72663,12 +72668,12 @@ function VideoMedia(media, xlr) {
|
|
|
72663
72668
|
// Temporary setting
|
|
72664
72669
|
expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
|
|
72665
72670
|
})["finally"](function () {
|
|
72666
|
-
|
|
72667
|
-
vjsPlayer.dispose();
|
|
72668
|
-
media.emitter.emit('end', media);
|
|
72671
|
+
endVideo();
|
|
72669
72672
|
});
|
|
72673
|
+
} else {
|
|
72674
|
+
endVideo();
|
|
72670
72675
|
}
|
|
72671
|
-
case
|
|
72676
|
+
case 6:
|
|
72672
72677
|
case "end":
|
|
72673
72678
|
return _context.stop();
|
|
72674
72679
|
}
|
|
@@ -72686,53 +72691,91 @@ function VideoMedia(media, xlr) {
|
|
|
72686
72691
|
});
|
|
72687
72692
|
vjsPlayer.on('ready', function () {
|
|
72688
72693
|
vjsPlayer.muted(true);
|
|
72689
|
-
|
|
72690
|
-
|
|
72691
|
-
|
|
72692
|
-
|
|
72693
|
-
|
|
72694
|
-
|
|
72695
|
-
|
|
72696
|
-
|
|
72697
|
-
|
|
72698
|
-
|
|
72699
|
-
|
|
72700
|
-
|
|
72701
|
-
|
|
72702
|
-
|
|
72703
|
-
|
|
72704
|
-
|
|
72705
|
-
|
|
72706
|
-
|
|
72707
|
-
|
|
72708
|
-
|
|
72709
|
-
|
|
72710
|
-
|
|
72711
|
-
|
|
72712
|
-
|
|
72713
|
-
|
|
72714
|
-
};
|
|
72715
|
-
}
|
|
72716
|
-
}
|
|
72694
|
+
// Race promise between a 0.5s play and a 5s skip
|
|
72695
|
+
Promise.race([new Promise(function (resolve, reject) {
|
|
72696
|
+
return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
72697
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
72698
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72699
|
+
case 0:
|
|
72700
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72701
|
+
// Try to force play here
|
|
72702
|
+
_context2.prev = 1;
|
|
72703
|
+
_context2.next = 4;
|
|
72704
|
+
return vjsPlayer.play();
|
|
72705
|
+
case 4:
|
|
72706
|
+
// Resolve if play works
|
|
72707
|
+
resolve(true);
|
|
72708
|
+
_context2.next = 10;
|
|
72709
|
+
break;
|
|
72710
|
+
case 7:
|
|
72711
|
+
_context2.prev = 7;
|
|
72712
|
+
_context2.t0 = _context2["catch"](1);
|
|
72713
|
+
// Reject race if play fails
|
|
72714
|
+
reject('Play failed');
|
|
72715
|
+
case 10:
|
|
72716
|
+
case "end":
|
|
72717
|
+
return _context2.stop();
|
|
72718
|
+
}
|
|
72719
|
+
}, _callee2, null, [[1, 7]]);
|
|
72720
|
+
})), 100);
|
|
72721
|
+
}), new Promise(function (_, reject) {
|
|
72722
|
+
return setTimeout(function () {
|
|
72723
|
+
return reject('Timeout');
|
|
72724
|
+
}, 5000);
|
|
72725
|
+
})]).then(function () {
|
|
72726
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72727
|
+
})["catch"]( /*#__PURE__*/function () {
|
|
72728
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
|
|
72729
|
+
var _media$emitter;
|
|
72730
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
72731
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
72732
|
+
case 0:
|
|
72733
|
+
if (!(error === 'Timeout')) {
|
|
72734
|
+
_context3.next = 6;
|
|
72735
|
+
break;
|
|
72736
|
+
}
|
|
72737
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72738
|
+
vjsPlayer.dispose();
|
|
72739
|
+
(_media$emitter = media.emitter) === null || _media$emitter === void 0 || _media$emitter.emit('end', media);
|
|
72740
|
+
_context3.next = 10;
|
|
72741
|
+
break;
|
|
72742
|
+
case 6:
|
|
72743
|
+
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72744
|
+
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72745
|
+
_context3.next = 10;
|
|
72746
|
+
break;
|
|
72747
|
+
}
|
|
72748
|
+
_context3.next = 10;
|
|
72749
|
+
return playerReportFault('Media autoplay error');
|
|
72750
|
+
case 10:
|
|
72751
|
+
case "end":
|
|
72752
|
+
return _context3.stop();
|
|
72753
|
+
}
|
|
72754
|
+
}, _callee3);
|
|
72755
|
+
}));
|
|
72756
|
+
return function (_x2) {
|
|
72757
|
+
return _ref3.apply(this, arguments);
|
|
72758
|
+
};
|
|
72759
|
+
}());
|
|
72717
72760
|
});
|
|
72718
72761
|
vjsPlayer.on('playing', function () {
|
|
72719
72762
|
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72720
72763
|
vjsPlayer.muted(media.muted);
|
|
72721
72764
|
});
|
|
72722
72765
|
vjsPlayer.on('error', /*#__PURE__*/function () {
|
|
72723
|
-
var
|
|
72724
|
-
return _regeneratorRuntime().wrap(function
|
|
72725
|
-
while (1) switch (
|
|
72766
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
|
|
72767
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
72768
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
72726
72769
|
case 0:
|
|
72727
72770
|
console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72728
72771
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72729
|
-
|
|
72772
|
+
_context4.next = 6;
|
|
72730
72773
|
break;
|
|
72731
72774
|
}
|
|
72732
|
-
|
|
72775
|
+
_context4.next = 4;
|
|
72733
72776
|
return playerReportFault('Video file source not supported');
|
|
72734
72777
|
case 4:
|
|
72735
|
-
|
|
72778
|
+
_context4.next = 7;
|
|
72736
72779
|
break;
|
|
72737
72780
|
case 6:
|
|
72738
72781
|
// End media after 5 seconds
|
|
@@ -72743,18 +72786,18 @@ function VideoMedia(media, xlr) {
|
|
|
72743
72786
|
}, 5000);
|
|
72744
72787
|
case 7:
|
|
72745
72788
|
case "end":
|
|
72746
|
-
return
|
|
72789
|
+
return _context4.stop();
|
|
72747
72790
|
}
|
|
72748
|
-
},
|
|
72791
|
+
}, _callee4);
|
|
72749
72792
|
}));
|
|
72750
72793
|
return function (_x3) {
|
|
72751
|
-
return
|
|
72794
|
+
return _ref4.apply(this, arguments);
|
|
72752
72795
|
};
|
|
72753
72796
|
}());
|
|
72754
72797
|
vjsPlayer.on('ended', function () {
|
|
72755
|
-
var _media$
|
|
72798
|
+
var _media$emitter2;
|
|
72756
72799
|
console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72757
|
-
(_media$
|
|
72800
|
+
(_media$emitter2 = media.emitter) === null || _media$emitter2 === void 0 || _media$emitter2.emit('end', media);
|
|
72758
72801
|
vjsPlayer.dispose();
|
|
72759
72802
|
});
|
|
72760
72803
|
vjsPlayer.on('durationchange', function () {
|
|
@@ -73133,7 +73176,7 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
73133
73176
|
$media = getNewMedia();
|
|
73134
73177
|
}
|
|
73135
73178
|
if (!$media) {
|
|
73136
|
-
_context2.next =
|
|
73179
|
+
_context2.next = 39;
|
|
73137
73180
|
break;
|
|
73138
73181
|
}
|
|
73139
73182
|
$media.style.setProperty('display', 'block');
|
|
@@ -73162,48 +73205,46 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
73162
73205
|
_context2.t3 = _context2.t2;
|
|
73163
73206
|
_context2.t4 = _context2.t1.concat.call(_context2.t1, _context2.t3);
|
|
73164
73207
|
_context2.t0.setProperty.call(_context2.t0, 'background-image', _context2.t4);
|
|
73165
|
-
_context2.next =
|
|
73208
|
+
_context2.next = 38;
|
|
73166
73209
|
break;
|
|
73167
73210
|
case 22:
|
|
73168
73211
|
if (!(self.mediaType === 'video' && self.url !== null)) {
|
|
73169
|
-
_context2.next =
|
|
73212
|
+
_context2.next = 26;
|
|
73170
73213
|
break;
|
|
73171
73214
|
}
|
|
73172
73215
|
// Initialize video.js
|
|
73173
|
-
videojs($media, {
|
|
73216
|
+
self.player = videojs($media, {
|
|
73174
73217
|
controls: false,
|
|
73175
73218
|
preload: 'auto',
|
|
73176
73219
|
autoplay: false,
|
|
73177
73220
|
muted: self.muted,
|
|
73178
73221
|
errorDisplay: xlr.config.platform !== 'chromeOS',
|
|
73179
|
-
restoreEl: $media,
|
|
73180
73222
|
loop: self.loop
|
|
73181
73223
|
});
|
|
73182
|
-
|
|
73183
|
-
_context2.next = 39;
|
|
73224
|
+
_context2.next = 38;
|
|
73184
73225
|
break;
|
|
73185
|
-
case
|
|
73226
|
+
case 26:
|
|
73186
73227
|
if (!(self.mediaType === 'audio' && self.url !== null)) {
|
|
73187
|
-
_context2.next =
|
|
73228
|
+
_context2.next = 37;
|
|
73188
73229
|
break;
|
|
73189
73230
|
}
|
|
73190
73231
|
if (!isCMS) {
|
|
73191
|
-
_context2.next =
|
|
73232
|
+
_context2.next = 33;
|
|
73192
73233
|
break;
|
|
73193
73234
|
}
|
|
73194
|
-
_context2.next =
|
|
73235
|
+
_context2.next = 30;
|
|
73195
73236
|
return preloadMediaBlob(self.url, self.mediaType);
|
|
73196
|
-
case
|
|
73237
|
+
case 30:
|
|
73197
73238
|
_context2.t5 = _context2.sent;
|
|
73198
|
-
_context2.next =
|
|
73239
|
+
_context2.next = 34;
|
|
73199
73240
|
break;
|
|
73200
|
-
case
|
|
73241
|
+
case 33:
|
|
73201
73242
|
_context2.t5 = self.url;
|
|
73202
|
-
case
|
|
73243
|
+
case 34:
|
|
73203
73244
|
$media.src = _context2.t5;
|
|
73204
|
-
_context2.next =
|
|
73245
|
+
_context2.next = 38;
|
|
73205
73246
|
break;
|
|
73206
|
-
case
|
|
73247
|
+
case 37:
|
|
73207
73248
|
if ((self.render === 'html' || self.mediaType === 'webpage') && self.iframe && self.checkIframeStatus) {
|
|
73208
73249
|
// Set state as false ( for now )
|
|
73209
73250
|
self.ready = false;
|
|
@@ -73219,9 +73260,9 @@ function Media(region, mediaId, xml, options, xlr) {
|
|
|
73219
73260
|
// }
|
|
73220
73261
|
// });
|
|
73221
73262
|
}
|
|
73222
|
-
case
|
|
73263
|
+
case 38:
|
|
73223
73264
|
self.emitter.emit('start', self);
|
|
73224
|
-
case
|
|
73265
|
+
case 39:
|
|
73225
73266
|
case "end":
|
|
73226
73267
|
return _context2.stop();
|
|
73227
73268
|
}
|
|
@@ -73283,6 +73324,9 @@ function Region(layout, xml, regionId, options, xlr) {
|
|
|
73283
73324
|
self.complete = false;
|
|
73284
73325
|
self.ending = false;
|
|
73285
73326
|
self.ended = false;
|
|
73327
|
+
self.curMedia = undefined;
|
|
73328
|
+
self.nxtMedia = undefined;
|
|
73329
|
+
self.currentMediaIndex = 0;
|
|
73286
73330
|
self.id = props.regionId;
|
|
73287
73331
|
self.uniqueId = "".concat(nextId(self.options));
|
|
73288
73332
|
self.options = _objectSpread2(_objectSpread2({}, platform), props.options);
|
|
@@ -74570,9 +74614,7 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74570
74614
|
console.debug('prepareLayouts::xlr>layouts', self.layouts);
|
|
74571
74615
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
74572
74616
|
layouts.map(function (layoutItem) {
|
|
74573
|
-
|
|
74574
|
-
self.layouts[layoutItem.index] = layoutItem;
|
|
74575
|
-
}
|
|
74617
|
+
self.layouts[layoutItem.index] = layoutItem;
|
|
74576
74618
|
});
|
|
74577
74619
|
self.currentLayoutIndex = xlrLayouts.currentLayoutIndex;
|
|
74578
74620
|
self.currentLayout = self.layouts[self.currentLayoutIndex];
|