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