@desynova-digital/player 4.1.3 → 4.1.5

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.
@@ -203,6 +203,9 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
203
203
  var _this;
204
204
  _classCallCheck(this, Player);
205
205
  _this = _callSuper(this, Player, [props]);
206
+ _defineProperty(_this, "getPlayerInstance", function () {
207
+ return _this;
208
+ });
206
209
  _defineProperty(_this, "handleFullscreenFix", function () {
207
210
  // Also trigger our fullscreen handler so ESC exits resize everything reliably.
208
211
  _this.handleFullScreenChange();
@@ -237,6 +240,11 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
237
240
  reviewIndex: index
238
241
  });
239
242
  });
243
+ _defineProperty(_this, "updateSubtitlePreviewDirect", function (previewData) {
244
+ if (_this.video && _this.video.updateSubtitlePreviewDirect) {
245
+ _this.video.updateSubtitlePreviewDirect(previewData);
246
+ }
247
+ });
240
248
  // handleFullScreenChange() {
241
249
  // this.actions.handleFullscreenChange(fullscreen.isFullscreen);
242
250
  // }
@@ -553,6 +561,7 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
553
561
  _this2._controlBar = c;
554
562
  },
555
563
  key: "control-bar",
564
+ settingsData: tabMetadata === null || tabMetadata === void 0 ? void 0 : tabMetadata.settings_data,
556
565
  pauseOnOutMarkerSelect: fullProps.pauseOnOutMarkerSelect,
557
566
  order: 5,
558
567
  playerType: fullProps.playerType,
@@ -648,6 +657,7 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
648
657
  _this4._controlBar = c;
649
658
  },
650
659
  key: "control-bar",
660
+ settingsData: tabMetadata === null || tabMetadata === void 0 ? void 0 : tabMetadata.settings_data,
651
661
  pauseOnOutMarkerSelect: fullProps.pauseOnOutMarkerSelect,
652
662
  order: 3,
653
663
  playerType: fullProps.playerType,
@@ -783,13 +793,17 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
783
793
  }, {
784
794
  key: "seek",
785
795
  value: function seek(time) {
796
+ var pauseOnSeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
797
+ if (pauseOnSeek) {
798
+ this.video.pause();
799
+ }
786
800
  this.video.seek(time);
787
801
  }
788
-
789
- // jump forward x seconds
790
802
  }, {
791
803
  key: "forward",
792
- value: function forward(seconds) {
804
+ value:
805
+ // jump forward x seconds
806
+ function forward(seconds) {
793
807
  this.video.forward(seconds);
794
808
  }
795
809
 
@@ -140,6 +140,19 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
140
140
  _defineProperty(_this, "onVideoTimeUpdate", function () {
141
141
  _this.updateAnnotateVisibility();
142
142
  });
143
+ _defineProperty(_this, "updateSubtitlePreviewDirect", function (previewData) {
144
+ var style = _this.getSubtitleStyle(previewData);
145
+ _this.setState({
146
+ currentSubtitleObj: {
147
+ charactername: previewData.charactername || '',
148
+ line1: previewData.line1 || '',
149
+ line2: previewData.line2 || '',
150
+ start_time: previewData.in_time || 0,
151
+ end_time: previewData.out_time || 0,
152
+ style: style
153
+ }
154
+ });
155
+ });
143
156
  _defineProperty(_this, "buildSmoothPath", function (points, width, height) {
144
157
  if (!points || points.length < 2) return '';
145
158
  var startX = points[0].x * width;
@@ -58,7 +58,8 @@ function MarkingControl(_ref) {
58
58
  enablePlayerActions = _ref.enablePlayerActions,
59
59
  pauseOnOutMarkerSelect = _ref.pauseOnOutMarkerSelect,
60
60
  timeCodeFormat = _ref.timeCodeFormat,
61
- onRightMenuVisible = _ref.onRightMenuVisible;
61
+ onRightMenuVisible = _ref.onRightMenuVisible,
62
+ settingsData = _ref.settingsData;
62
63
  var shouldShowMarkers = function shouldShowMarkers() {
63
64
  var missingAnyMarker = !((playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.leftMarker) > -1) || !((playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.rightMarker) > -1);
64
65
  var blockedType = playerType === 'panel' || playerType === 'default' || playerType === 'clipping_default';
@@ -79,6 +80,7 @@ function MarkingControl(_ref) {
79
80
  playerType: playerType,
80
81
  onRightMenuVisible: onRightMenuVisible
81
82
  })) : null, (playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.leftMarker) > -1 || (playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.rightMarker) > -1 ? /*#__PURE__*/_react["default"].createElement(_MarkingDuration["default"], {
83
+ settingsData: settingsData,
82
84
  theme: theme,
83
85
  leftMarker: playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.leftMarker,
84
86
  rightMarker: playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.rightMarker,
@@ -19,12 +19,20 @@ var propTypes = {
19
19
  frameRate: _propTypes.PropTypes.number,
20
20
  initialTime: _propTypes.PropTypes.number,
21
21
  timeCodeFormat: _propTypes.PropTypes.string,
22
- theme: _propTypes.PropTypes.string
22
+ theme: _propTypes.PropTypes.string,
23
+ settingsData: _propTypes.PropTypes.instanceOf(Object)
23
24
  };
24
25
  var defaultProps = {
25
26
  leftMarker: -1,
26
27
  rightMarker: -1,
27
- frameRate: 0
28
+ frameRate: 0,
29
+ settingsData: {
30
+ allowOverlappingVal: true,
31
+ maxCharCountVal: 50,
32
+ maxTimeLimitVal: 7,
33
+ minTimeLimitVal: 2,
34
+ showCharCountVal: true
35
+ }
28
36
  };
29
37
  var themeColor = function themeColor(theme) {
30
38
  return theme ? _tokens.colors[theme].videoPlayer.themeColor : '#00cec6';
@@ -42,10 +50,16 @@ var DurationOnlyWrap = _styledComponents["default"].div(_templateObject2 || (_te
42
50
  var DurationRow = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: nowrap;\n justify-content: center;\n\n /* bracket icons (your in-marker/out-marker) */\n ", " {\n background: transparent;\n box-shadow: none;\n margin: 0;\n\n svg path {\n fill: ", ";\n width: 8px;\n }\n }\n"])), _components.Icon.Element, function (p) {
43
51
  return themeColor(p.theme);
44
52
  });
45
- var DurationPill = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 8px 14px;\n border-radius: 5px;\n background: #0c141d;\n box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);\n min-width: 120px;\n width: auto;\n white-space: nowrap;\n"])));
46
- var DurText = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-family: SFUIText-Medium;\n font-size: 11px;\n color: rgba(255, 255, 255, 0.72);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n white-space: nowrap;\n"])));
53
+ var DurationPill = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 8px 14px;\n border-radius: 5px;\n background: ", ";\n border: ", ";\n box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);\n min-width: 120px;\n width: auto;\n white-space: nowrap;\n transition: all 0.2s ease;\n"])), function (p) {
54
+ return p.pillBackground || '#0c141d';
55
+ }, function (p) {
56
+ return p.pillBorder || 'none';
57
+ });
58
+ var DurText = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-family: SFUIText-Medium;\n font-size: 11px;\n color: ", ";\n display: inline-flex;\n align-items: center;\n gap: 6px;\n white-space: nowrap;\n transition: color 0.2s ease;\n"])), function (p) {
59
+ return p.textColor || 'rgba(255, 255, 255, 0.72)';
60
+ });
47
61
  var Dot = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: ", ";\n"])), function (p) {
48
- return themeColor(p.theme);
62
+ return p.textColor || themeColor(p.theme);
49
63
  });
50
64
 
51
65
  /* ---------------- Hover + Tooltip ---------------- */
@@ -53,71 +67,73 @@ var HoverTarget = _styledComponents["default"].span(_templateObject7 || (_templa
53
67
  var InOutTooltip = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n left: 50%;\n bottom: calc(100% + 1px);\n transform: translate(-50%, 0);\n opacity: 0;\n pointer-events: none;\n transition: 150ms ease;\n z-index: 9999;\n\n .bubble {\n min-width: 150px;\n padding: 10px 12px;\n border-radius: 10px;\n background: rgba(10, 18, 26, 0.95);\n box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);\n position: relative;\n }\n\n /* Downward teal arrow for tooltip */\n .bubble::after {\n content: '';\n position: absolute;\n left: 50%;\n bottom: -8px;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 6px solid ", ";\n filter: drop-shadow(0 2px 6px rgba(0, 206, 198, 0.35));\n }\n\n .row {\n display: flex;\n align-items: center;\n gap: 10px;\n margin: 0;\n }\n .row + .row {\n margin-top: 4px;\n }\n\n .key {\n font-size: 12px;\n font-family: SFUIText-Medium;\n\n line-height: 14px;\n color: rgba(255, 255, 255, 0.72);\n min-width: 28px;\n }\n"])), function (p) {
54
68
  return themeColor(p.theme);
55
69
  });
70
+ var getDurationStyles = function getDurationStyles(duration, maxTimeLimitVal, minTimeLimitVal) {
71
+ var isOutOfBounds = duration < minTimeLimitVal || duration > maxTimeLimitVal;
72
+ if (isOutOfBounds) {
73
+ return {
74
+ textColor: '#FF6C56',
75
+ background: 'rgba(255, 108, 86, 0.10)',
76
+ border: '1px solid #FF6C56'
77
+ };
78
+ }
79
+ return {
80
+ textColor: '#18B96E',
81
+ background: '#18B96E33',
82
+ border: '1px solid #18B96E'
83
+ };
84
+ };
56
85
  function MarkingDuration(_ref) {
57
86
  var leftMarker = _ref.leftMarker,
58
87
  rightMarker = _ref.rightMarker,
59
88
  initialTime = _ref.initialTime,
60
89
  frameRate = _ref.frameRate,
61
90
  theme = _ref.theme,
62
- timeCodeFormat = _ref.timeCodeFormat;
91
+ timeCodeFormat = _ref.timeCodeFormat,
92
+ settingsData = _ref.settingsData;
63
93
  var hasAny = leftMarker > -1 || rightMarker > -1;
64
94
  if (!hasAny) return null;
65
95
  var hasBoth = leftMarker > -1 && rightMarker > -1;
66
96
  var leftMarkerVal = (0, _utils.secondsToTime)(leftMarker, frameRate, initialTime);
67
97
  var rightMarkerVal = (0, _utils.secondsToTime)(rightMarker, frameRate, initialTime);
68
- var durMarkerVal = hasBoth ? (0, _utils.secondsToTime)(rightMarker - leftMarker, frameRate) : null;
98
+ var durationInSeconds = hasBoth ? rightMarker - leftMarker : null;
99
+ var durMarkerVal = hasBoth ? (0, _utils.secondsToTime)(durationInSeconds, frameRate) : null;
69
100
  var showTooltip = hasBoth;
70
- /* ---------------- CASE 1: OLD FLOW UI showDuration = false ---------------- */
71
- // if (!showDuration) {
72
- // return (
73
- // <MarkingDurationBlock theme={theme}>
74
- // <Icon name="in-marker" width={6} height={18} />
75
-
76
- // {leftMarker > -1 && (
77
- // <p>
78
- // <TimeCodeDisplay
79
- // timecode={leftMarkerVal}
80
- // selectedTimecodeFormat={timeCodeFormat}
81
- // fps={frameRate}
82
- // />
83
- // </p>
84
- // )}
85
-
86
- // {hasBoth && (
87
- // <p>
88
- // {'{'} Dur:{' '}
89
- // <TimeCodeDisplay
90
- // timecode={durMarkerVal}
91
- // selectedTimecodeFormat={timeCodeFormat}
92
- // fps={frameRate}
93
- // />
94
- // {'} '}
95
- // <TimeCodeDisplay
96
- // timecode={rightMarkerVal}
97
- // selectedTimecodeFormat={timeCodeFormat}
98
- // fps={frameRate}
99
- // />
100
- // </p>
101
- // )}
102
-
103
- // <Icon name="out-marker" width={6} height={18} />
104
- // </MarkingDurationBlock>
105
- // );
106
- // }
107
-
108
- var pillContent = hasBoth ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Dur: ", /*#__PURE__*/_react["default"].createElement(_components.TimeCodeDisplay, {
101
+ var durationStyles = {
102
+ textColor: themeColor(theme),
103
+ background: '#0c141d',
104
+ border: 'none'
105
+ };
106
+ if (hasBoth && settingsData) {
107
+ var maxTimeLimitVal = settingsData.maxTimeLimitVal,
108
+ minTimeLimitVal = settingsData.minTimeLimitVal;
109
+ if (maxTimeLimitVal !== undefined && minTimeLimitVal !== undefined) {
110
+ durationStyles = getDurationStyles(durationInSeconds, maxTimeLimitVal, minTimeLimitVal);
111
+ }
112
+ }
113
+ var pillContent = hasBoth ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
114
+ style: {
115
+ color: durationStyles.textColor
116
+ }
117
+ }, "Dur:"), ' ', /*#__PURE__*/_react["default"].createElement(_components.TimeCodeDisplay, {
118
+ color: durationStyles.textColor,
109
119
  timecode: durMarkerVal,
110
120
  selectedTimecodeFormat: timeCodeFormat,
111
121
  fps: frameRate
112
- })) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "In: ", /*#__PURE__*/_react["default"].createElement(_components.TimeCodeDisplay, {
122
+ })) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "In:", ' ', /*#__PURE__*/_react["default"].createElement(_components.TimeCodeDisplay, {
113
123
  timecode: leftMarkerVal,
114
124
  selectedTimecodeFormat: timeCodeFormat,
115
125
  fps: frameRate
116
126
  }));
117
127
  return /*#__PURE__*/_react["default"].createElement(DurationOnlyWrap, null, /*#__PURE__*/_react["default"].createElement(HoverTarget, null, /*#__PURE__*/_react["default"].createElement(DurationRow, {
118
128
  theme: theme
119
- }, /*#__PURE__*/_react["default"].createElement(DurationPill, null, /*#__PURE__*/_react["default"].createElement(DurText, null, pillContent), /*#__PURE__*/_react["default"].createElement(Dot, {
120
- theme: theme
129
+ }, /*#__PURE__*/_react["default"].createElement(DurationPill, {
130
+ pillBackground: durationStyles.background,
131
+ pillBorder: durationStyles.border
132
+ }, /*#__PURE__*/_react["default"].createElement(DurText, {
133
+ textColor: durationStyles.textColor
134
+ }, pillContent), /*#__PURE__*/_react["default"].createElement(Dot, {
135
+ theme: theme,
136
+ textColor: durationStyles.textColor
121
137
  }))), showTooltip && /*#__PURE__*/_react["default"].createElement(InOutTooltip, {
122
138
  className: "inOutTooltip",
123
139
  theme: theme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {