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