@xibosignage/xibo-layout-renderer 1.0.16 → 1.0.17
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/xibo-layout-renderer.cjs.js +48 -33
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +1 -0
- package/dist/xibo-layout-renderer.esm.js +48 -33
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +48 -33
- package/dist/xibo-layout-renderer.min.js +1 -1
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -72669,9 +72669,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72669
72669
|
return $media;
|
|
72670
72670
|
}
|
|
72671
72671
|
function VideoMedia(media, xlr) {
|
|
72672
|
-
|
|
72672
|
+
return {
|
|
72673
|
+
duration: 0,
|
|
72673
72674
|
init: function init() {
|
|
72675
|
+
var _this = this;
|
|
72674
72676
|
var vjsPlayer = media.player;
|
|
72677
|
+
this.duration = media.duration;
|
|
72675
72678
|
if (vjsPlayer !== undefined) {
|
|
72676
72679
|
var playerReportFault = /*#__PURE__*/function () {
|
|
72677
72680
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
|
|
@@ -72697,10 +72700,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72697
72700
|
// Temporary setting
|
|
72698
72701
|
expires: format(new Date(setExpiry(1)), 'yyyy-MM-dd HH:mm:ss')
|
|
72699
72702
|
})["finally"](function () {
|
|
72700
|
-
|
|
72703
|
+
_this.stop();
|
|
72701
72704
|
});
|
|
72702
72705
|
} else {
|
|
72703
|
-
|
|
72706
|
+
_this.stop();
|
|
72704
72707
|
}
|
|
72705
72708
|
case 5:
|
|
72706
72709
|
case "end":
|
|
@@ -72713,11 +72716,26 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72713
72716
|
};
|
|
72714
72717
|
}();
|
|
72715
72718
|
vjsPlayer.on('loadstart', function () {
|
|
72716
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
|
|
72719
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has started loading data . . ."));
|
|
72717
72720
|
});
|
|
72718
|
-
vjsPlayer.
|
|
72719
|
-
|
|
72721
|
+
vjsPlayer.one('loadedmetadata', function () {
|
|
72722
|
+
if (media.duration === 0) {
|
|
72723
|
+
_this.duration = vjsPlayer.duration();
|
|
72724
|
+
}
|
|
72725
|
+
console.debug('VideoMedia: loadedmetadata: Setting video duration to = ' + _this.duration);
|
|
72726
|
+
});
|
|
72727
|
+
vjsPlayer.one('canplay', function () {
|
|
72728
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " can be played . . ."));
|
|
72720
72729
|
});
|
|
72730
|
+
vjsPlayer.one('playing', function () {
|
|
72731
|
+
console.debug('VideoMedia: playing: Showing Media ' + media.id + ' for ' + _this.duration + 's of Region ' + media.region.regionId);
|
|
72732
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72733
|
+
});
|
|
72734
|
+
// @NOTE: When video is paused due to fail in unmuting the video
|
|
72735
|
+
// and video has media.duration = 0, the video will stay paused and the video cycle won't end
|
|
72736
|
+
// @TODO: Add timer when video is paused due to unmuting fail and duration that is equal to 0
|
|
72737
|
+
// @NOTE: The pause issue when unmuting the video is mainly on a browser level.
|
|
72738
|
+
// Please visit https://developer.chrome.com/blog/autoplay/ for more info.
|
|
72721
72739
|
vjsPlayer.on('ready', function () {
|
|
72722
72740
|
vjsPlayer.muted(true);
|
|
72723
72741
|
// Race promise between a 0.5s play and a 5s skip
|
|
@@ -72726,33 +72744,35 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72726
72744
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
72727
72745
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72728
72746
|
case 0:
|
|
72729
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72747
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Trying to force play after 0.1 seconds"));
|
|
72730
72748
|
// Try to force play here
|
|
72731
72749
|
_context2.prev = 1;
|
|
72732
|
-
|
|
72750
|
+
// Set video mute/unmute based on setting once playing
|
|
72751
|
+
vjsPlayer.muted(media.muted);
|
|
72752
|
+
_context2.next = 5;
|
|
72733
72753
|
return vjsPlayer.play();
|
|
72734
|
-
case
|
|
72754
|
+
case 5:
|
|
72735
72755
|
// Resolve if play works
|
|
72736
72756
|
resolve(true);
|
|
72737
|
-
_context2.next =
|
|
72757
|
+
_context2.next = 11;
|
|
72738
72758
|
break;
|
|
72739
|
-
case
|
|
72740
|
-
_context2.prev =
|
|
72759
|
+
case 8:
|
|
72760
|
+
_context2.prev = 8;
|
|
72741
72761
|
_context2.t0 = _context2["catch"](1);
|
|
72742
72762
|
// Reject race if play fails
|
|
72743
72763
|
reject('Play failed');
|
|
72744
|
-
case
|
|
72764
|
+
case 11:
|
|
72745
72765
|
case "end":
|
|
72746
72766
|
return _context2.stop();
|
|
72747
72767
|
}
|
|
72748
|
-
}, _callee2, null, [[1,
|
|
72768
|
+
}, _callee2, null, [[1, 8]]);
|
|
72749
72769
|
})), 100);
|
|
72750
72770
|
}), new Promise(function (_, reject) {
|
|
72751
72771
|
return setTimeout(function () {
|
|
72752
72772
|
return reject('Timeout');
|
|
72753
72773
|
}, 5000);
|
|
72754
72774
|
})]).then(function () {
|
|
72755
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72775
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay started"));
|
|
72756
72776
|
})["catch"]( /*#__PURE__*/function () {
|
|
72757
72777
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
|
|
72758
72778
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -72762,12 +72782,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72762
72782
|
_context3.next = 5;
|
|
72763
72783
|
break;
|
|
72764
72784
|
}
|
|
72765
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72766
|
-
|
|
72785
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Promise not resolved within 5 seconds. Move to next media"));
|
|
72786
|
+
_this.stop();
|
|
72767
72787
|
_context3.next = 9;
|
|
72768
72788
|
break;
|
|
72769
72789
|
case 5:
|
|
72770
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72790
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " : Autoplay error: ").concat(error));
|
|
72771
72791
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72772
72792
|
_context3.next = 9;
|
|
72773
72793
|
break;
|
|
@@ -72785,16 +72805,12 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72785
72805
|
};
|
|
72786
72806
|
}());
|
|
72787
72807
|
});
|
|
72788
|
-
vjsPlayer.on('playing', function () {
|
|
72789
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " is now playing . . ."));
|
|
72790
|
-
vjsPlayer.muted(media.muted);
|
|
72791
|
-
});
|
|
72792
72808
|
vjsPlayer.on('error', /*#__PURE__*/function () {
|
|
72793
72809
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
|
|
72794
72810
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
72795
72811
|
while (1) switch (_context4.prev = _context4.next) {
|
|
72796
72812
|
case 0:
|
|
72797
|
-
console.debug("Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72813
|
+
console.debug("VideoMedia: Media Error: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id));
|
|
72798
72814
|
if (!(xlr.config.platform === 'chromeOS')) {
|
|
72799
72815
|
_context4.next = 6;
|
|
72800
72816
|
break;
|
|
@@ -72807,8 +72823,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72807
72823
|
case 6:
|
|
72808
72824
|
// End media after 5 seconds
|
|
72809
72825
|
setTimeout(function () {
|
|
72810
|
-
console.debug("".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
|
|
72811
|
-
|
|
72826
|
+
console.debug("VideoMedia: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended . . ."));
|
|
72827
|
+
_this.stop();
|
|
72812
72828
|
}, 5000);
|
|
72813
72829
|
case 7:
|
|
72814
72830
|
case "end":
|
|
@@ -72823,10 +72839,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72823
72839
|
if (media.duration === 0) {
|
|
72824
72840
|
vjsPlayer.on('ended', function () {
|
|
72825
72841
|
console.debug("VideoMedia: onended: ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72826
|
-
|
|
72827
|
-
});
|
|
72828
|
-
vjsPlayer.on('durationchange', function () {
|
|
72829
|
-
console.debug('VIDEOJS: ondurationchange: Showing Media ' + media.id + ' for ' + vjsPlayer.duration() + 's of Region ' + media.region.regionId);
|
|
72842
|
+
_this.stop();
|
|
72830
72843
|
});
|
|
72831
72844
|
}
|
|
72832
72845
|
}
|
|
@@ -72840,10 +72853,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72840
72853
|
media.emitter.emit('end', media);
|
|
72841
72854
|
}
|
|
72842
72855
|
vjsPlayer.dispose();
|
|
72856
|
+
// Clear up media player
|
|
72857
|
+
media.player = undefined;
|
|
72843
72858
|
}
|
|
72844
72859
|
}
|
|
72845
72860
|
};
|
|
72846
|
-
return videoMediaInstance;
|
|
72847
72861
|
}
|
|
72848
72862
|
|
|
72849
72863
|
function AudioMedia(media) {
|
|
@@ -72925,7 +72939,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72925
72939
|
media.emitter.emit('end', media);
|
|
72926
72940
|
if (media.mediaType === 'video') {
|
|
72927
72941
|
// Dispose the video media
|
|
72928
|
-
console.debug("VideoMedia::stop - ".concat(capitalizeStr(media.mediaType), " for media ").concat(media.id, " has
|
|
72942
|
+
console.debug("VideoMedia::stop - ".concat(capitalizeStr(media.mediaType), " for media > ").concat(media.id, " has ended playing . . ."));
|
|
72929
72943
|
VideoMedia(media, xlr).stop(true);
|
|
72930
72944
|
}
|
|
72931
72945
|
}
|
|
@@ -72934,7 +72948,8 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
72934
72948
|
};
|
|
72935
72949
|
emitter.on('start', function (media) {
|
|
72936
72950
|
if (media.mediaType === 'video') {
|
|
72937
|
-
VideoMedia(media, xlr)
|
|
72951
|
+
var videoMedia = VideoMedia(media, xlr);
|
|
72952
|
+
videoMedia.init();
|
|
72938
72953
|
if (media.duration > 0) {
|
|
72939
72954
|
startMediaTimer(media);
|
|
72940
72955
|
}
|
|
@@ -73255,7 +73270,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
|
|
|
73255
73270
|
controls: false,
|
|
73256
73271
|
preload: 'auto',
|
|
73257
73272
|
autoplay: false,
|
|
73258
|
-
muted:
|
|
73273
|
+
muted: true,
|
|
73259
73274
|
errorDisplay: xlr.config.platform !== 'chromeOS',
|
|
73260
73275
|
loop: self.loop
|
|
73261
73276
|
});
|