@desynova-digital/player 3.9.7 → 4.0.1

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.
Files changed (130) hide show
  1. package/Player.js +945 -0
  2. package/control/AudioTracksMenuButton.js +91 -0
  3. package/control/AudioTracksMenuButton.jsx +80 -0
  4. package/control/ControlBar.js +303 -0
  5. package/control/ControlBar.jsx +264 -0
  6. package/control/CurrentTimeDisplay.js +34 -0
  7. package/control/CurrentTimeDisplay.jsx +35 -0
  8. package/control/DurationDisplay.js +38 -0
  9. package/control/DurationDisplay.jsx +48 -0
  10. package/control/ForwardBackwardControl.js +76 -0
  11. package/control/ForwardBackwardControl.jsx +79 -0
  12. package/control/FullscreenToggle.js +82 -0
  13. package/control/FullscreenToggle.jsx +83 -0
  14. package/control/MarkInControl.js +124 -0
  15. package/control/MarkInControl.jsx +109 -0
  16. package/control/MarkOutControl.js +137 -0
  17. package/control/MarkOutControl.jsx +131 -0
  18. package/control/MarkerBar.js +127 -0
  19. package/control/MarkerBar.jsx +107 -0
  20. package/control/MarkingControl.js +82 -0
  21. package/control/MarkingControl.jsx +143 -0
  22. package/control/MarkingDuration.js +44 -0
  23. package/control/MarkingPreview.js +49 -0
  24. package/control/MarkingPreview.jsx +60 -0
  25. package/control/PlayBackRateControl.js +106 -0
  26. package/control/PlayBackRateControl.jsx +106 -0
  27. package/control/PlayProgressBar.js +61 -0
  28. package/control/PlayProgressBar.jsx +92 -0
  29. package/control/PlayToggle.js +56 -0
  30. package/control/PlayToggle.jsx +57 -0
  31. package/control/PointersBar.js +231 -0
  32. package/control/PointersBar.jsx +286 -0
  33. package/control/ProgressControl.js +127 -0
  34. package/control/ProgressControl.jsx +155 -0
  35. package/control/SeekBar.js +204 -0
  36. package/control/SeekBar.jsx +229 -0
  37. package/control/SettingsMenuButton.js +63 -0
  38. package/control/SettingsMenuButton.jsx +69 -0
  39. package/control/Slider.js +274 -0
  40. package/control/Slider.jsx +243 -0
  41. package/control/Timeline.js +118 -0
  42. package/control/Timeline.jsx +131 -0
  43. package/control/VolumeBar.js +198 -0
  44. package/control/VolumeBar.jsx +174 -0
  45. package/control/VolumeLevel.js +61 -0
  46. package/control/VolumeLevel.jsx +66 -0
  47. package/control/VolumneMenuButton.js +112 -0
  48. package/control/VolumneMenuButton.jsx +111 -0
  49. package/header/Header.js +309 -0
  50. package/header/Header.jsx +479 -0
  51. package/index.js +9 -151
  52. package/media/AudioMeter.js +381 -0
  53. package/media/AudioMeter.jsx +411 -0
  54. package/media/SDOutline.js +82 -0
  55. package/media/SDOutline.jsx +90 -0
  56. package/media/Video.js +684 -0
  57. package/media/Video.jsx +714 -0
  58. package/package.json +5 -1
  59. package/playlist/Playlist.js +67 -0
  60. package/playlist/Playlist.jsx +91 -0
  61. package/playlist/index.js +13 -0
  62. package/shortcuts/Shortcut.js +662 -0
  63. package/utils/Menu.js +50 -0
  64. package/utils/Menu.jsx +105 -0
  65. package/{colors.js → utils/colors.js} +13 -13
  66. package/utils/dom.js +6 -16
  67. package/utils/index.js +52 -122
  68. package/Manager.js +0 -124
  69. package/actions/player.js +0 -375
  70. package/actions/video.js +0 -230
  71. package/components/AudioMeter.js +0 -414
  72. package/components/BigPlayButton.js +0 -110
  73. package/components/ImageViewer.js +0 -318
  74. package/components/MarkerBar.js +0 -138
  75. package/components/Menu.js +0 -77
  76. package/components/Player.js +0 -821
  77. package/components/PlayerHeader.js +0 -472
  78. package/components/Playlist.js +0 -133
  79. package/components/PointersBar.js +0 -299
  80. package/components/PosterImage.js +0 -61
  81. package/components/SDOutline.js +0 -68
  82. package/components/Shortcut.js +0 -621
  83. package/components/Slider.js +0 -317
  84. package/components/TagsBar.js +0 -100
  85. package/components/Video.js +0 -1431
  86. package/components/control-bar/AudioTracksMenuButton.js +0 -113
  87. package/components/control-bar/CameraButton.js +0 -88
  88. package/components/control-bar/CommentsButton.js +0 -216
  89. package/components/control-bar/ControlBar.js +0 -260
  90. package/components/control-bar/EditorControlMenuButton.js +0 -412
  91. package/components/control-bar/ForwardControl.js +0 -17
  92. package/components/control-bar/ForwardReplayControl.js +0 -122
  93. package/components/control-bar/FullscreenToggle.js +0 -101
  94. package/components/control-bar/PlayToggle.js +0 -98
  95. package/components/control-bar/ReplayControl.js +0 -17
  96. package/components/control-bar/SettingsMenuButton.js +0 -43
  97. package/components/control-bar/SubtitleLanguagesMenuButton.js +0 -174
  98. package/components/control-bar/VolumeMenuButton.js +0 -134
  99. package/components/control-bar/ZoomMenuButton.js +0 -116
  100. package/components/marking-controls/MarkInControl.js +0 -140
  101. package/components/marking-controls/MarkOutControl.js +0 -155
  102. package/components/marking-controls/MarkingAddButton.js +0 -94
  103. package/components/marking-controls/MarkingControl.js +0 -135
  104. package/components/marking-controls/MarkingDeleteButton.js +0 -84
  105. package/components/marking-controls/MarkingDuration.js +0 -77
  106. package/components/marking-controls/MarkingPreview.js +0 -86
  107. package/components/progress-bar/AudioWaveform.js +0 -144
  108. package/components/progress-bar/LoadProgressBar.js +0 -90
  109. package/components/progress-bar/MouseTimeDisplay.js +0 -53
  110. package/components/progress-bar/PlayProgressBar.js +0 -79
  111. package/components/progress-bar/ProgressControl.js +0 -222
  112. package/components/progress-bar/SeekBar.js +0 -261
  113. package/components/progress-bar/Timeline.js +0 -134
  114. package/components/settings-menu-control/PlaybackRateControl.js +0 -147
  115. package/components/settings-menu-control/SafeAreaControl.js +0 -92
  116. package/components/settings-menu-control/SettingsMenu.js +0 -68
  117. package/components/settings-menu-control/SubtitleControl.js +0 -1
  118. package/components/time-controls/CurrentTimeDisplay.js +0 -53
  119. package/components/time-controls/DurationDisplay.js +0 -51
  120. package/components/time-controls/TimeDivider.js +0 -41
  121. package/components/volume-control/VolumeBar.js +0 -216
  122. package/components/volume-control/VolumeControl.js +0 -35
  123. package/components/volume-control/VolumeLevel.js +0 -78
  124. package/components/zoom-control/ZoomBar.js +0 -189
  125. package/components/zoom-control/ZoomLevel.js +0 -68
  126. package/reducers/index.js +0 -23
  127. package/reducers/operation.js +0 -36
  128. package/reducers/player.js +0 -222
  129. package/utils/browser.js +0 -29
  130. package/utils/fullscreen.js +0 -73
@@ -0,0 +1,83 @@
1
+ import React, { Component } from 'react';
2
+ import { PropTypes } from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { Button } from '@desynova-digital/components';
5
+
6
+ const propTypes = {
7
+ actions: PropTypes.instanceOf(Object),
8
+ player: PropTypes.instanceOf(Object),
9
+ playerType: PropTypes.oneOf([
10
+ 'dubbing_review',
11
+ 'clipping_default',
12
+ 'default',
13
+ 'tagging',
14
+ 'qc',
15
+ 'subtitle',
16
+ 'snp_edit',
17
+ 'archive',
18
+ 'restore',
19
+ 'clipping',
20
+ 'storyboard',
21
+ 'panel'
22
+ ])
23
+ };
24
+
25
+ const defaultProps = {
26
+ actions: {},
27
+ player: {}
28
+ };
29
+
30
+ const FullscreenToggleButton = styled(Button)`
31
+ background: transparent;
32
+ border: none;
33
+ margin: 0 10px;
34
+ &:hover,
35
+ &:focus {
36
+ background: transparent;
37
+ svg path {
38
+ fill: #00cec6;
39
+ }
40
+ }
41
+ `;
42
+
43
+ export default class FullscreenToggle extends Component {
44
+ constructor(props, context) {
45
+ super(props, context);
46
+
47
+ this.handleClick = this.handleClick.bind(this);
48
+ }
49
+
50
+ handleClick() {
51
+ const { actionClick } = this.props;
52
+ actionClick({
53
+ action: 'toggle_fullscreen'
54
+ });
55
+ }
56
+
57
+ render() {
58
+ const { playerType } = this.props;
59
+ return (
60
+ <React.Fragment>
61
+ {playerType !== 'panel' ? (
62
+ <FullscreenToggleButton
63
+ display="rounded"
64
+ appearance="cta"
65
+ icon="fullscreen"
66
+ ref={(c) => {
67
+ this.button = c;
68
+ }}
69
+ onClick={this.handleClick}
70
+ iconWidth={14}
71
+ iconHeight={14}
72
+ width={20}
73
+ height={20}
74
+ />
75
+ ) : null}
76
+ </React.Fragment>
77
+ );
78
+ }
79
+ }
80
+
81
+ FullscreenToggle.propTypes = propTypes;
82
+ FullscreenToggle.defaultProps = defaultProps;
83
+ FullscreenToggle.displayName = 'FullscreenToggle';
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _propTypes = require("prop-types");
10
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
+ var _components = require("@desynova-digital/components");
12
+ var _templateObject;
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
24
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
29
+ var propTypes = {
30
+ actions: _propTypes.PropTypes.instanceOf(Object),
31
+ player: _propTypes.PropTypes.instanceOf(Object),
32
+ markers: _propTypes.PropTypes.instanceOf(Object),
33
+ leftMarker: _propTypes.PropTypes.number,
34
+ allowMarkerOverlap: _propTypes.PropTypes.bool
35
+ };
36
+ var defaultProps = {
37
+ actions: {},
38
+ player: {},
39
+ leftMarker: -1,
40
+ allowMarkerOverlap: false
41
+ };
42
+ var MarkInButton = (0, _styledComponents["default"])(_components.Button)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n margin: 0px 10px;\n pointer-events: ", ";\n ", " {\n svg path {\n fill: ", ";\n }\n }\n &:hover {\n background: transparent;\n ", " {\n svg path {\n fill: #00cec6;\n }\n }\n }\n &:focus {\n background: transparent;\n }\n"])), function (props) {
43
+ return props.leftMarker > -1 ? 'none' : 'all';
44
+ }, _components.Icon.Element, function (props) {
45
+ return props.leftMarker > -1 ? '#00cec6' : '#ffffff';
46
+ }, _components.Icon.Element);
47
+ var MarkInControl = /*#__PURE__*/function (_Component) {
48
+ _inherits(MarkInControl, _Component);
49
+ var _super = _createSuper(MarkInControl);
50
+ function MarkInControl(props) {
51
+ var _this;
52
+ _classCallCheck(this, MarkInControl);
53
+ _this = _super.call(this, props);
54
+ _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
55
+ return _this;
56
+ }
57
+ _createClass(MarkInControl, [{
58
+ key: "getStyle",
59
+ value: function getStyle() {
60
+ var _this$props = this.props,
61
+ currentTime = _this$props.currentTime,
62
+ markers = _this$props.markers,
63
+ leftMarker = _this$props.leftMarker,
64
+ allowMarkerOverlap = _this$props.allowMarkerOverlap;
65
+ var style = {
66
+ pointerEvents: 'all',
67
+ opacity: 1
68
+ };
69
+ if (markers && markers.length && markers[0].values && markers[0].values.length && !allowMarkerOverlap) {
70
+ markers[0].values.filter(function (marker) {
71
+ if (currentTime >= marker.start_time && currentTime <= marker.end_time || leftMarker > -1 && currentTime > marker.start_time && leftMarker < marker.start_time || leftMarker > -1 && currentTime < marker.start_time && leftMarker > marker.end_time) {
72
+ style = {
73
+ pointerEvents: 'none',
74
+ opacity: 0.6
75
+ };
76
+ }
77
+ });
78
+ }
79
+ return style;
80
+ }
81
+ }, {
82
+ key: "handleClick",
83
+ value: function handleClick() {
84
+ var _this$props2 = this.props,
85
+ markerType = _this$props2.markerType,
86
+ onAddMarker = _this$props2.onAddMarker,
87
+ currentTime = _this$props2.currentTime;
88
+ // actions.handleMarkerPointChange('add', 'left', player.currentTime);
89
+ if (onAddMarker) {
90
+ var data = {
91
+ markerType: markerType !== 'update' ? 'add' : 'update',
92
+ markerPos: 'left',
93
+ currentTime: currentTime.seconds
94
+ };
95
+ onAddMarker(currentTime.seconds, -1, '', true, data);
96
+ }
97
+ }
98
+ }, {
99
+ key: "render",
100
+ value: function render() {
101
+ var _this$props3 = this.props,
102
+ leftMarker = _this$props3.leftMarker,
103
+ markers = _this$props3.markers;
104
+ return /*#__PURE__*/_react["default"].createElement(MarkInButton, {
105
+ leftMarker: leftMarker,
106
+ markers: markers,
107
+ display: "rounded",
108
+ appearance: "cta",
109
+ icon: "in-marker",
110
+ iconWidth: 10,
111
+ iconHeight: 18,
112
+ width: 10,
113
+ height: 20,
114
+ onClick: this.handleClick,
115
+ style: this.getStyle()
116
+ });
117
+ }
118
+ }]);
119
+ return MarkInControl;
120
+ }(_react.Component);
121
+ exports["default"] = MarkInControl;
122
+ MarkInControl.propTypes = propTypes;
123
+ MarkInControl.defaultProps = defaultProps;
124
+ MarkInControl.displayName = 'MarkInControl';
@@ -0,0 +1,109 @@
1
+ import React, { Component } from 'react';
2
+ import { PropTypes } from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { Button, Icon } from '@desynova-digital/components';
5
+
6
+ const propTypes = {
7
+ actions: PropTypes.instanceOf(Object),
8
+ player: PropTypes.instanceOf(Object),
9
+ markers: PropTypes.instanceOf(Object),
10
+ leftMarker: PropTypes.number,
11
+ allowMarkerOverlap: PropTypes.bool
12
+ };
13
+
14
+ const defaultProps = {
15
+ actions: {},
16
+ player: {},
17
+ leftMarker: -1,
18
+ allowMarkerOverlap: false
19
+ };
20
+
21
+ const MarkInButton = styled(Button)`
22
+ background: transparent;
23
+ border: none;
24
+ margin: 0px 10px;
25
+ pointer-events: ${(props) => (props.leftMarker > -1 ? 'none' : 'all')};
26
+ ${Icon.Element} {
27
+ svg path {
28
+ fill: ${(props) => (props.leftMarker > -1 ? '#00cec6' : '#ffffff')};
29
+ }
30
+ }
31
+ &:hover {
32
+ background: transparent;
33
+ ${Icon.Element} {
34
+ svg path {
35
+ fill: #00cec6;
36
+ }
37
+ }
38
+ }
39
+ &:focus {
40
+ background: transparent;
41
+ }
42
+ `;
43
+
44
+ export default class MarkInControl extends Component {
45
+ constructor(props) {
46
+ super(props);
47
+ this.handleClick = this.handleClick.bind(this);
48
+ }
49
+
50
+ getStyle() {
51
+ const { currentTime, markers, leftMarker, allowMarkerOverlap } = this.props;
52
+ let style = {
53
+ pointerEvents: 'all',
54
+ opacity: 1
55
+ };
56
+ if (markers && markers.length && markers[0].values && markers[0].values.length && !allowMarkerOverlap) {
57
+ markers[0].values.filter((marker) => {
58
+ if (
59
+ (currentTime >= marker.start_time && currentTime <= marker.end_time) ||
60
+ (leftMarker > -1 && currentTime > marker.start_time && leftMarker < marker.start_time) ||
61
+ (leftMarker > -1 && currentTime < marker.start_time && leftMarker > marker.end_time)
62
+ ) {
63
+ style = {
64
+ pointerEvents: 'none',
65
+ opacity: 0.6
66
+ };
67
+ }
68
+ });
69
+ }
70
+
71
+ return style;
72
+ }
73
+
74
+ handleClick() {
75
+ const { markerType, onAddMarker, currentTime } = this.props;
76
+ // actions.handleMarkerPointChange('add', 'left', player.currentTime);
77
+ if (onAddMarker) {
78
+ let data = {
79
+ markerType: markerType !== 'update' ? 'add' : 'update',
80
+ markerPos: 'left',
81
+ currentTime: currentTime.seconds
82
+ };
83
+ onAddMarker(currentTime.seconds, -1, '', true, data);
84
+ }
85
+ }
86
+
87
+ render() {
88
+ const { leftMarker, markers } = this.props;
89
+ return (
90
+ <MarkInButton
91
+ leftMarker={leftMarker}
92
+ markers={markers}
93
+ display="rounded"
94
+ appearance="cta"
95
+ icon="in-marker"
96
+ iconWidth={10}
97
+ iconHeight={18}
98
+ width={10}
99
+ height={20}
100
+ onClick={this.handleClick}
101
+ style={this.getStyle()}
102
+ />
103
+ );
104
+ }
105
+ }
106
+
107
+ MarkInControl.propTypes = propTypes;
108
+ MarkInControl.defaultProps = defaultProps;
109
+ MarkInControl.displayName = 'MarkInControl';
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _propTypes = require("prop-types");
11
+ var _components = require("@desynova-digital/components");
12
+ var _templateObject;
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
24
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
29
+ var propTypes = {
30
+ player: _propTypes.PropTypes.instanceOf(Object),
31
+ actions: _propTypes.PropTypes.instanceOf(Object),
32
+ markers: _propTypes.PropTypes.instanceOf(Object),
33
+ leftMarker: _propTypes.PropTypes.number,
34
+ rightMarker: _propTypes.PropTypes.number,
35
+ controlType: _propTypes.PropTypes.string,
36
+ onMarkerSelect: _propTypes.PropTypes.func,
37
+ allowMarkerOverlap: _propTypes.PropTypes.bool
38
+ };
39
+ var defaultProps = {
40
+ player: {},
41
+ actions: {},
42
+ leftMarker: -1,
43
+ rightMarker: -1,
44
+ allowMarkerOverlap: false
45
+ };
46
+ var MarkOutButton = (0, _styledComponents["default"])(_components.Button)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n margin: 0px 10px;\n pointer-events: ", ";\n ", " {\n svg path {\n fill: ", ";\n }\n }\n &:hover {\n background: transparent;\n ", " {\n svg path {\n fill: #00cec6;\n }\n }\n }\n &:focus {\n background: transparent;\n }\n"])), function (props) {
47
+ return props.leftMarker > -1 && props.currentTime < props.leftMarker || props.leftMarker < 0 ? 'none' : 'all';
48
+ }, _components.Icon.Element, function (props) {
49
+ return props.rightMarker > -1 ? '#00cec6' : props.leftMarker > -1 && props.currentTime < props.leftMarker || props.leftMarker < 0 ? '#ffffff88' : '#ffffff';
50
+ }, _components.Icon.Element);
51
+ var MarkOutControl = /*#__PURE__*/function (_Component) {
52
+ _inherits(MarkOutControl, _Component);
53
+ var _super = _createSuper(MarkOutControl);
54
+ function MarkOutControl(props) {
55
+ var _this;
56
+ _classCallCheck(this, MarkOutControl);
57
+ _this = _super.call(this, props);
58
+ _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
59
+ return _this;
60
+ }
61
+ _createClass(MarkOutControl, [{
62
+ key: "getStyle",
63
+ value: function getStyle() {
64
+ var _this$props = this.props,
65
+ currentTime = _this$props.currentTime,
66
+ markers = _this$props.markers,
67
+ leftMarker = _this$props.leftMarker,
68
+ allowMarkerOverlap = _this$props.allowMarkerOverlap;
69
+ var style = {
70
+ pointerEvents: 'all',
71
+ opacity: 1
72
+ };
73
+ if (markers && markers.length && markers[0].values && markers[0].values.length && !allowMarkerOverlap) {
74
+ markers[0].values.filter(function (marker) {
75
+ if (currentTime >= marker.start_time && currentTime <= marker.end_time || leftMarker > -1 && currentTime > marker.start_time && leftMarker < marker.start_time || leftMarker > -1 && currentTime < marker.start_time && leftMarker > marker.end_time) {
76
+ style = {
77
+ pointerEvents: 'none',
78
+ opacity: 0.6
79
+ };
80
+ }
81
+ });
82
+ }
83
+ return style;
84
+ }
85
+ }, {
86
+ key: "handleClick",
87
+ value: function handleClick() {
88
+ var _this$props2 = this.props,
89
+ leftMarker = _this$props2.leftMarker,
90
+ onAddMarker = _this$props2.onAddMarker,
91
+ markerType = _this$props2.markerType,
92
+ currentTime = _this$props2.currentTime;
93
+ if (leftMarker > -1 && currentTime.seconds > leftMarker) {
94
+ // actions.handleMarkerPointChange('add', 'right', player.currentTime);
95
+ //Commented for CN-632.
96
+ // if (controlType === 'default') {
97
+ // onMarkerSelect(leftMarker, player.currentTime);
98
+ // }
99
+ // actions.handleMarkerPointChange('create');
100
+ var data = {
101
+ markerType: markerType !== 'update' ? 'add' : 'update',
102
+ markerPos: 'right',
103
+ currentTime: currentTime.seconds
104
+ };
105
+ onAddMarker(leftMarker, currentTime.seconds, 'update', false, data);
106
+ // onAddMarker(leftMarker, player.currentTime);
107
+ }
108
+ }
109
+ }, {
110
+ key: "render",
111
+ value: function render() {
112
+ var _this$props3 = this.props,
113
+ rightMarker = _this$props3.rightMarker,
114
+ leftMarker = _this$props3.leftMarker,
115
+ currentTime = _this$props3.player.currentTime;
116
+ return /*#__PURE__*/_react["default"].createElement(MarkOutButton, {
117
+ rightMarker: rightMarker,
118
+ leftMarker: leftMarker,
119
+ currentTime: currentTime,
120
+ display: "rounded",
121
+ appearance: "cta",
122
+ icon: "out-marker",
123
+ iconWidth: 10,
124
+ iconHeight: 18,
125
+ width: 10,
126
+ height: 20,
127
+ onClick: this.handleClick,
128
+ style: this.getStyle()
129
+ });
130
+ }
131
+ }]);
132
+ return MarkOutControl;
133
+ }(_react.Component);
134
+ exports["default"] = MarkOutControl;
135
+ MarkOutControl.propTypes = propTypes;
136
+ MarkOutControl.defaultProps = defaultProps;
137
+ MarkOutControl.displayName = 'MarkOutControl';
@@ -0,0 +1,131 @@
1
+ import React, { Component } from 'react';
2
+ import styled from 'styled-components';
3
+ import { PropTypes } from 'prop-types';
4
+ import { Button, Icon } from '@desynova-digital/components';
5
+
6
+ const propTypes = {
7
+ player: PropTypes.instanceOf(Object),
8
+ actions: PropTypes.instanceOf(Object),
9
+ markers: PropTypes.instanceOf(Object),
10
+ leftMarker: PropTypes.number,
11
+ rightMarker: PropTypes.number,
12
+ controlType: PropTypes.string,
13
+ onMarkerSelect: PropTypes.func,
14
+ allowMarkerOverlap: PropTypes.bool
15
+ };
16
+
17
+ const defaultProps = {
18
+ player: {},
19
+ actions: {},
20
+ leftMarker: -1,
21
+ rightMarker: -1,
22
+ allowMarkerOverlap: false
23
+ };
24
+
25
+ const MarkOutButton = styled(Button)`
26
+ background: transparent;
27
+ border: none;
28
+ margin: 0px 10px;
29
+ pointer-events: ${(props) =>
30
+ (props.leftMarker > -1 && props.currentTime < props.leftMarker) || props.leftMarker < 0 ? 'none' : 'all'};
31
+ ${Icon.Element} {
32
+ svg path {
33
+ fill: ${(props) =>
34
+ props.rightMarker > -1
35
+ ? '#00cec6'
36
+ : (props.leftMarker > -1 && props.currentTime < props.leftMarker) || props.leftMarker < 0
37
+ ? '#ffffff88'
38
+ : '#ffffff'};
39
+ }
40
+ }
41
+ &:hover {
42
+ background: transparent;
43
+ ${Icon.Element} {
44
+ svg path {
45
+ fill: #00cec6;
46
+ }
47
+ }
48
+ }
49
+ &:focus {
50
+ background: transparent;
51
+ }
52
+ `;
53
+
54
+ export default class MarkOutControl extends Component {
55
+ constructor(props) {
56
+ super(props);
57
+
58
+ this.handleClick = this.handleClick.bind(this);
59
+ }
60
+
61
+ getStyle() {
62
+ const { currentTime, markers, leftMarker, allowMarkerOverlap } = this.props;
63
+ let style = {
64
+ pointerEvents: 'all',
65
+ opacity: 1
66
+ };
67
+ if (markers && markers.length && markers[0].values && markers[0].values.length && !allowMarkerOverlap) {
68
+ markers[0].values.filter((marker) => {
69
+ if (
70
+ (currentTime >= marker.start_time && currentTime <= marker.end_time) ||
71
+ (leftMarker > -1 && currentTime > marker.start_time && leftMarker < marker.start_time) ||
72
+ (leftMarker > -1 && currentTime < marker.start_time && leftMarker > marker.end_time)
73
+ ) {
74
+ style = {
75
+ pointerEvents: 'none',
76
+ opacity: 0.6
77
+ };
78
+ }
79
+ });
80
+ }
81
+
82
+ return style;
83
+ }
84
+
85
+ handleClick() {
86
+ const { leftMarker, onAddMarker, markerType, currentTime } = this.props;
87
+ if (leftMarker > -1 && currentTime.seconds > leftMarker) {
88
+ // actions.handleMarkerPointChange('add', 'right', player.currentTime);
89
+ //Commented for CN-632.
90
+ // if (controlType === 'default') {
91
+ // onMarkerSelect(leftMarker, player.currentTime);
92
+ // }
93
+ // actions.handleMarkerPointChange('create');
94
+ let data = {
95
+ markerType: markerType !== 'update' ? 'add' : 'update',
96
+ markerPos: 'right',
97
+ currentTime: currentTime.seconds
98
+ };
99
+ onAddMarker(leftMarker, currentTime.seconds, 'update', false, data);
100
+ // onAddMarker(leftMarker, player.currentTime);
101
+ }
102
+ }
103
+
104
+ render() {
105
+ const {
106
+ rightMarker,
107
+ leftMarker,
108
+ player: { currentTime }
109
+ } = this.props;
110
+ return (
111
+ <MarkOutButton
112
+ rightMarker={rightMarker}
113
+ leftMarker={leftMarker}
114
+ currentTime={currentTime}
115
+ display="rounded"
116
+ appearance="cta"
117
+ icon="out-marker"
118
+ iconWidth={10}
119
+ iconHeight={18}
120
+ width={10}
121
+ height={20}
122
+ onClick={this.handleClick}
123
+ style={this.getStyle()}
124
+ />
125
+ );
126
+ }
127
+ }
128
+
129
+ MarkOutControl.propTypes = propTypes;
130
+ MarkOutControl.defaultProps = defaultProps;
131
+ MarkOutControl.displayName = 'MarkOutControl';