@desynova-digital/player 4.0.42 → 4.0.44

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.
@@ -11,8 +11,8 @@ var _SettingsMenu = _interopRequireDefault(require("../settings-menu-control/Set
11
11
  var _excluded = ["style", "player", "actions", "disablePlayerActions", "theme", "playerType", "subtitleData"];
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
13
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
14
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
14
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
16
16
  var propTypes = {
17
17
  player: _propTypes.PropTypes.instanceOf(Object),
18
18
  actions: _propTypes.PropTypes.instanceOf(Object),
@@ -118,14 +118,18 @@ var SeekBar = exports["default"] = /*#__PURE__*/function (_Component) {
118
118
  var distance = this.slider.calculateDistance(event);
119
119
  newTime = distance * duration;
120
120
  } else {
121
- var seekBar = document.getElementById('timeline-block');
122
- var clickPosition = event.clientX - seekBar.getBoundingClientRect().left;
123
- var data = this.getScrollableWidth(seekBar);
124
- var seekPercentage = clickPosition / data;
121
+ var seekBar = event.currentTarget || event.target.closest('#timeline-block');
122
+ if (!seekBar) {
123
+ console.warn('Seekbar element not found.');
124
+ return 0;
125
+ }
126
+ var rect = seekBar.getBoundingClientRect();
127
+ var clickPosition = event.clientX - rect.left;
128
+ // Optional improvement: getScrollableWidth could be replaced with rect.width if that's what it returns.
129
+ var totalWidth = typeof this.getScrollableWidth === 'function' ? this.getScrollableWidth(seekBar) : rect.width;
130
+ var seekPercentage = clickPosition / totalWidth;
125
131
  newTime = duration * seekPercentage;
126
132
  }
127
-
128
- // Don't let video end while scrubbing.
129
133
  return newTime === duration ? newTime - 0.1 : newTime;
130
134
  }
131
135
  }, {
@@ -33,9 +33,7 @@ var propTypes = {
33
33
  initialTime: _propTypes.PropTypes.number,
34
34
  frameRate: _propTypes.PropTypes.number
35
35
  };
36
- var TimelineBlock = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: stretch;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0;\n width: ", ";\n .player-time {\n width: 100%;\n :not(:last-child) {\n min-width: 100px;\n }\n position: relative;\n height: 46px;\n user-select: none;\n &:first-child {\n p {\n left: 0px;\n }\n }\n &:last-child {\n flex-grow: 1;\n ", " {\n display: none;\n }\n p {\n left: auto;\n right: 0px;\n }\n }\n ", " {\n position: absolute;\n left: 0;\n bottom: 0;\n }\n p {\n color: #aaa;\n font-size: 10px;\n font-family: SFUIText-Regular;\n left: -28px;\n top: 10px;\n letter-spacing: 0.5px;\n position: absolute;\n user-select: none;\n }\n }\n"])), function (props) {
37
- return props.maxWidth ? props.maxWidth : '';
38
- }, _components.Icon.Element, _components.Icon.Element);
36
+ var TimelineBlock = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: stretch;\n width: 100%;\n height: 46px;\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n\n .player-time {\n flex: 0 0 auto;\n width: 100px;\n height: 100%;\n position: relative;\n user-select: none;\n\n &:first-child p {\n left: 0;\n }\n\n &:last-child {\n flex-grow: 1;\n ", " {\n display: none;\n }\n p {\n left: auto;\n right: 0;\n }\n }\n\n ", " {\n position: absolute;\n left: 0;\n bottom: 0;\n }\n\n p {\n position: absolute;\n font-size: 10px;\n font-family: SFUIText-Regular;\n color: #aaa;\n top: 10px;\n left: -28px;\n letter-spacing: 0.5px;\n }\n }\n"])), _components.Icon.Element, _components.Icon.Element);
39
37
  var Timeline = exports["default"] = /*#__PURE__*/function (_Component) {
40
38
  function Timeline(props, context) {
41
39
  var _this;
@@ -65,31 +63,32 @@ var Timeline = exports["default"] = /*#__PURE__*/function (_Component) {
65
63
  key: "generateTimeline",
66
64
  value: function generateTimeline(zoomFactor) {
67
65
  var player = this.props.player;
68
- var timelineBlock = (0, _reactDom.findDOMNode)(this.timelineBlock);
69
- var perTimeWidth = 100;
70
- var sliderWidth = 0;
71
- if (zoomFactor > 0) {
72
- sliderWidth = (document.getElementById('seekbar-control-block').clientWidth * zoomFactor * 20).toFixed(0);
73
- } else {
74
- sliderWidth = document.getElementById('seekbar-control-block').clientWidth.toFixed(0);
75
- }
76
- var timeBlocks = parseInt(sliderWidth / perTimeWidth, 10);
77
- var timeDistance = parseInt(player.duration / timeBlocks, 10);
78
- var timeArray = [0];
79
- for (var i = 0; i < timeBlocks; i++) {
80
- var lastValue = timeArray[timeArray.length - 1];
81
- var currentTime = lastValue + timeDistance;
82
- if (currentTime + timeDistance < player.duration) {
83
- timeArray.push(currentTime);
84
- } else {
85
- timeArray.push(player.duration);
86
- break;
87
- }
66
+ var seekbar = document.getElementById('seekbar-control-block');
67
+ if (!seekbar) return;
68
+ var baseBlockWidth = 100;
69
+ var sliderWidth;
70
+
71
+ // Calculate slider width based on zoom
72
+ var baseWidth = seekbar.clientWidth;
73
+ sliderWidth = zoomFactor > 0 ? Math.round(baseWidth * zoomFactor * 20) : Math.round(baseWidth);
74
+
75
+ // Calculate how many full blocks of 100px fit, and the leftover width
76
+ var noOfBlocks = Math.floor(sliderWidth / baseBlockWidth);
77
+
78
+ // Compute time distance between ticks
79
+ var totalDuration = player.duration; // e.g., 20s
80
+ var timeDistance = totalDuration / noOfBlocks;
81
+
82
+ // Create time array
83
+ var timeArray = [];
84
+ for (var i = 0; i <= noOfBlocks; i++) {
85
+ var timePoint = parseFloat((i * timeDistance).toFixed(2));
86
+ timeArray.push(Math.min(timePoint, totalDuration));
88
87
  }
89
88
  this.setState({
90
89
  timeArray: timeArray,
91
90
  zoom: zoomFactor,
92
- maxWidth: sliderWidth + 'px'
91
+ maxWidth: "".concat(sliderWidth, "px")
93
92
  });
94
93
  }
95
94
  }, {
@@ -98,7 +97,8 @@ var Timeline = exports["default"] = /*#__PURE__*/function (_Component) {
98
97
  var _this2 = this;
99
98
  var _this$props2 = this.props,
100
99
  initialTime = _this$props2.initialTime,
101
- frameRate = _this$props2.frameRate;
100
+ frameRate = _this$props2.frameRate,
101
+ player = _this$props2.player;
102
102
  var _this$state = this.state,
103
103
  timeArray = _this$state.timeArray,
104
104
  maxWidth = _this$state.maxWidth;
@@ -110,11 +110,14 @@ var Timeline = exports["default"] = /*#__PURE__*/function (_Component) {
110
110
  }
111
111
  }, timeArray.map(function (time) {
112
112
  var formattedTime = (0, _utils.secondsToTime)(time, frameRate, initialTime);
113
+ var leftPercent = time / player.duration * 100;
113
114
  return /*#__PURE__*/_react["default"].createElement("div", {
114
115
  className: "player-time",
115
- ref: function ref(c) {
116
- _this2.timelineContainer = c;
117
- },
116
+ style: {
117
+ position: 'absolute',
118
+ left: "".concat(leftPercent, "%")
119
+ } // Fix marker alignment
120
+ ,
118
121
  key: time
119
122
  }, /*#__PURE__*/_react["default"].createElement("p", null, formattedTime), /*#__PURE__*/_react["default"].createElement(_components.Icon, {
120
123
  name: "timeline",
@@ -26,8 +26,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
26
26
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
27
27
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
28
28
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
30
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
29
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
30
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
31
31
  function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
32
32
  /*
33
33
  * import SubtitleControl from './SubtitleControl';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "4.0.42",
3
+ "version": "4.0.44",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@desynova-digital/components": "^9.1.3",
57
57
  "@desynova-digital/tokens": "^9.1.3",
58
- "hls.js": "1.4.12",
58
+ "hls.js": "1.6.2",
59
59
  "babel-core": "7.0.0-bridge.0",
60
60
  "latest-version": "^4.0.0",
61
61
  "prettycli": "^1.4.3",