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