@desynova-digital/player 4.0.90 → 4.0.91

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/actions/player.js CHANGED
@@ -199,13 +199,37 @@ function mute(muted) {
199
199
  operation: operation
200
200
  };
201
201
  }
202
+ function safeAppend(parent, child) {
203
+ if (!parent || !child) return;
204
+
205
+ // Prevent circular nesting
206
+ if (child.contains(parent)) return; // ❌ cannot append parent inside child
207
+
208
+ // Prevent duplicates
209
+ if (parent.contains(child)) return; // already appended
210
+
211
+ parent.appendChild(child); // safe
212
+ }
213
+
214
+ // keep this outside so original parent is remembered across toggles
215
+ var toastOriginalParent = null;
202
216
  function toggleFullscreen(player) {
203
217
  if (_fullscreen["default"].enabled) {
204
- // var elem = document.getElementsByClassName('left-video-section')[0];
205
- var elem = document.getElementsByClassName('player-container')[0];
218
+ var elem = document.querySelector('.player-container');
206
219
  var right = document.querySelector('.right-video-section');
220
+ var root = document.getElementById('root'); // app root
221
+ var toastRoot = root.children[0];
222
+ var fallbackParent = root || document.body;
207
223
  if (_fullscreen["default"].isFullscreen) {
224
+ // exit fullscreen
208
225
  _fullscreen["default"].exit();
226
+
227
+ // restore toast to its original parent (or fallback)
228
+ if (toastRoot) {
229
+ var parentToRestore = toastOriginalParent || fallbackParent;
230
+ // parentToRestore.appendChild(toastRoot);
231
+ safeAppend(parentToRestore, toastRoot);
232
+ }
209
233
  setTimeout(function () {
210
234
  if (right) {
211
235
  right.style.removeProperty('transition');
@@ -215,6 +239,14 @@ function toggleFullscreen(player) {
215
239
  }
216
240
  }, 300);
217
241
  } else {
242
+ // entering fullscreen
243
+ if (toastRoot && !toastOriginalParent) {
244
+ toastOriginalParent = toastRoot.parentNode || fallbackParent;
245
+ }
246
+ if (toastRoot && elem) {
247
+ // elem.appendChild(toastRoot);
248
+ safeAppend(elem, toastRoot);
249
+ }
218
250
  _fullscreen["default"].request(elem);
219
251
  }
220
252
  return {
@@ -225,11 +257,48 @@ function toggleFullscreen(player) {
225
257
  }
226
258
  };
227
259
  }
260
+
261
+ // <-- this return must be outside the if-block
228
262
  return {
229
263
  type: FULLSCREEN_CHANGE,
230
264
  isFullscreen: !player.isFullscreen
231
265
  };
232
266
  }
267
+
268
+ // export function toggleFullscreen(player) {
269
+ // if (fullscreen.enabled) {
270
+ // // var elem = document.getElementsByClassName('left-video-section')[0];
271
+ // var elem = document.getElementsByClassName('player-container')[0];
272
+ // const right = document.querySelector('.right-video-section');
273
+
274
+ // if (fullscreen.isFullscreen) {
275
+ // fullscreen.exit();
276
+ // setTimeout(() => {
277
+ // if (right) {
278
+ // right.style.removeProperty('transition');
279
+ // right.style.removeProperty('display');
280
+ // right.style.removeProperty('transform');
281
+ // right.style.removeProperty('opacity');
282
+ // }
283
+ // }, 300);
284
+ // } else {
285
+ // fullscreen.request(elem);
286
+ // }
287
+ // return {
288
+ // type: OPERATE,
289
+ // operation: {
290
+ // action: 'toggle-fullscreen',
291
+ // source: ''
292
+ // }
293
+ // };
294
+ // }
295
+
296
+ // return {
297
+ // type: FULLSCREEN_CHANGE,
298
+ // isFullscreen: !player.isFullscreen
299
+ // };
300
+ // }
301
+
233
302
  function toggleRightBar(player, showRightMenu) {
234
303
  var right = document.querySelector('.right-video-section');
235
304
  var sidebarWidth = right.offsetWidth; // actual width of sidebar
@@ -39,7 +39,9 @@ var propTypes = {
39
39
  var defaultProps = {
40
40
  height: 0
41
41
  };
42
- var RangeBlock = (0, _styledComponents["default"])('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n right: -12px;\n height: 100%;\n overflow: hidden;\n .range {\n color: #aaaaaa;\n font-family: SFUIText-Medium;\n text-align: right;\n font-size: 8px;\n box-sizing: border-box;\n }\n"])));
42
+ var RangeBlock = (0, _styledComponents["default"])('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n right: -12px;\n background-color: ", ";\n height: 100%;\n overflow: hidden;\n .range {\n color: #aaaaaa;\n font-family: SFUIText-Medium;\n text-align: right;\n font-size: 8px;\n box-sizing: border-box;\n }\n"])), function (props) {
43
+ return props.isFullscreen ? '#000' : 'unset';
44
+ });
43
45
  var MeterBlock = (0, _styledComponents["default"])('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n .track-block {\n position: relative;\n width: 15px;\n height: 100%;\n overflow: visible;\n &.left-track,\n &.right-track {\n &:after {\n position: absolute;\n color: #aaaaaa;\n bottom: -12px;\n font-size: 10px;\n left: 50%;\n transform: translateX(-50%);\n font-family: SFUIText-Regular;\n }\n }\n &.left-track:after {\n content: 'L';\n }\n &.right-track:after {\n content: 'R';\n }\n }\n"])));
44
46
  var ColorMeter = (0, _styledComponents["default"])('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n background: linear-gradient(\n to top,\n #00c8e7,\n #00e6b9 57%,\n #ff8d29 83%,\n #f6462c\n );\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n .stack-block {\n height: 2px;\n margin-bottom: 3px;\n background: #000000;\n }\n"])));
45
47
  var BlackMeter = (0, _styledComponents["default"])('div')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n background: #000000;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n height: 100%;\n transition: all 0.25s ease-in-out;\n -moz-transition: all 0.25s ease-in-out;\n -webkit-transition: all 0.25s ease-in-out;\n -ms-transition: all 0.25s ease-in-out;\n -o-transition: all 0.25s ease-in-out;\n .stack-block {\n height: 2px;\n margin-bottom: 3px;\n background: #304153;\n }\n"])));
@@ -290,7 +292,10 @@ var AudioMeter = exports["default"] = /*#__PURE__*/function (_Component) {
290
292
  rangeArray = _this$state.rangeArray,
291
293
  unitBlockHeight = _this$state.unitBlockHeight,
292
294
  audioPan = _this$state.audioPan;
293
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(RangeBlock, null, rangeArray.map(function (range) {
295
+ var isFullscreen = this.props.isFullscreen;
296
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(RangeBlock, {
297
+ isFullscreen: isFullscreen
298
+ }, rangeArray.map(function (range) {
294
299
  return /*#__PURE__*/_react["default"].createElement("div", {
295
300
  key: 'range' + range,
296
301
  style: {
@@ -158,7 +158,7 @@ var defaultProps = {
158
158
  onVolumeChange: null
159
159
  };
160
160
  var PlayerBlock = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n"])));
161
- var PlayerContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-start;\n background: #000000;\n .left-video-section {\n width: ", ";\n position: relative;\n }\n .audio-meter-block {\n position: relative;\n width: 0px;\n display: none;\n &.qc {\n width: 70px;\n display: block;\n }\n }\n .right-video-section {\n width: ", ";\n position: relative;\n }\n"])), function (props) {
161
+ var PlayerContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-start;\n background: #000000;\n .left-video-section {\n width: ", ";\n position: relative;\n }\n .audio-meter-block {\n position: relative;\n width: 0px;\n display: none;\n &.qc {\n width: 70px;\n display: block;\n }\n }\n .right-video-section {\n width: ", ";\n"])), function (props) {
162
162
  if (!props.isRightMenuVisible) {
163
163
  return '100%';
164
164
  }
@@ -168,7 +168,9 @@ var PlayerContainer = _styledComponents["default"].div(_templateObject2 || (_tem
168
168
  return '100%';
169
169
  }
170
170
  }, function (props) {
171
- if (props.playerType === 'qc') {
171
+ if (props.isFullscreen && props.playerType === 'qc') {
172
+ return 'calc(38.1% - 70px)';
173
+ } else if (props.playerType === 'qc') {
172
174
  return 'calc(36.33% - 70px)';
173
175
  } else {
174
176
  return '36.33%';
@@ -208,6 +210,42 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
208
210
  onRightMenuVisible(false);
209
211
  }
210
212
  });
213
+ // handleFullScreenChange() {
214
+ // this.actions.handleFullscreenChange(fullscreen.isFullscreen);
215
+ // }
216
+ _defineProperty(_this, "handleFullScreenChange", function () {
217
+ var onRightMenuVisible = _this.props.onRightMenuVisible;
218
+ var rightSectionRef = _this._rightSectionRef;
219
+ var playerHeader = (0, _reactDom.findDOMNode)(_this._playerHeader);
220
+ var headerHeight = playerHeader ? playerHeader.offsetHeight : 60;
221
+ var totalHeight = window.innerHeight;
222
+ var newHeight;
223
+ var isFS = _fullscreen["default"].isFullscreen;
224
+ _this.actions.handleFullscreenChange(isFS);
225
+ if (isFS) {
226
+ rightSectionRef.style.position = 'relative';
227
+ newHeight = totalHeight - headerHeight;
228
+ rightSectionRef.style.top = "".concat(headerHeight, "px");
229
+ rightSectionRef.style.height = "".concat(newHeight, "px");
230
+ }
231
+ // If exited fullscreen
232
+ if (!isFS) {
233
+ // Hide right sidebar
234
+ var right = document.querySelector('.right-video-section');
235
+ if (right) {
236
+ right.style.removeProperty('transition');
237
+ right.style.removeProperty('display');
238
+ right.style.removeProperty('transform');
239
+ right.style.removeProperty('opacity');
240
+ right.style.removeProperty('right');
241
+ }
242
+
243
+ // Reset UI state in parent
244
+ if (onRightMenuVisible) {
245
+ onRightMenuVisible(true);
246
+ }
247
+ }
248
+ });
211
249
  _this.controlsHideTimer = null;
212
250
  _this.meterHeight = 40;
213
251
  _this.video = null; // the Video component
@@ -851,11 +889,6 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
851
889
  }
852
890
  // this.video.handleResize();
853
891
  }
854
- }, {
855
- key: "handleFullScreenChange",
856
- value: function handleFullScreenChange() {
857
- this.actions.handleFullscreenChange(_fullscreen["default"].isFullscreen);
858
- }
859
892
  }, {
860
893
  key: "handleStateChange",
861
894
  value: function handleStateChange(state, prevState) {
@@ -880,7 +913,9 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
880
913
  }, {
881
914
  key: "render",
882
915
  value: function render() {
883
- var _this5 = this;
916
+ var _this5 = this,
917
+ _props$player,
918
+ _props$player2;
884
919
  var _this$manager$getStat4 = this.manager.getState(),
885
920
  player = _this$manager$getStat4.player;
886
921
  var props = _objectSpread(_objectSpread({}, this.props), {}, {
@@ -912,7 +947,8 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
912
947
  }
913
948
  }, props, {
914
949
  hasRightSection: !!rightSection,
915
- isRightMenuVisible: isRightMenuVisible
950
+ isRightMenuVisible: isRightMenuVisible,
951
+ isFullscreen: (_props$player = props.player) === null || _props$player === void 0 ? void 0 : _props$player.isFullscreen
916
952
  }), /*#__PURE__*/_react["default"].createElement("div", {
917
953
  className: "left-video-section",
918
954
  ref: function ref(leftSectionRef) {
@@ -931,7 +967,8 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
931
967
  active: true
932
968
  }, /*#__PURE__*/_react["default"].createElement(_AudioMeter["default"], {
933
969
  player: props.player,
934
- height: this.meterHeight
970
+ height: this.meterHeight,
971
+ isFullscreen: (_props$player2 = props.player) === null || _props$player2 === void 0 ? void 0 : _props$player2.isFullscreen
935
972
  }))), rightSection ? /*#__PURE__*/_react["default"].createElement("div", {
936
973
  className: "right-video-section",
937
974
  ref: function ref(rightSectionRef) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "4.0.90",
3
+ "version": "4.0.91",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {