@desynova-digital/player 4.0.1 → 4.0.3

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 (111) hide show
  1. package/Manager.js +99 -0
  2. package/actions/player.js +331 -0
  3. package/actions/video.js +206 -0
  4. package/{utils/colors.js → colors.js} +1 -2
  5. package/{media → components}/AudioMeter.js +96 -109
  6. package/components/BigPlayButton.js +84 -0
  7. package/components/ImageViewer.js +272 -0
  8. package/{control → components}/MarkerBar.js +33 -24
  9. package/{utils → components}/Menu.js +13 -4
  10. package/components/Player.js +706 -0
  11. package/{header/Header.js → components/PlayerHeader.js} +104 -78
  12. package/components/Playlist.js +95 -0
  13. package/{control → components}/PointersBar.js +122 -61
  14. package/components/PosterImage.js +50 -0
  15. package/{media → components}/SDOutline.js +13 -49
  16. package/components/Shortcut.js +821 -0
  17. package/{control → components}/Slider.js +27 -23
  18. package/components/TagsBar.js +81 -0
  19. package/components/Video.js +1280 -0
  20. package/{control → components/control-bar}/AudioTracksMenuButton.js +32 -28
  21. package/components/control-bar/CameraButton.js +75 -0
  22. package/components/control-bar/CommentsButton.js +186 -0
  23. package/components/control-bar/ControlBar.js +266 -0
  24. package/components/control-bar/EditorControlMenuButton.js +317 -0
  25. package/components/control-bar/ForwardControl.js +12 -0
  26. package/components/control-bar/ForwardReplayControl.js +106 -0
  27. package/{control → components/control-bar}/FullscreenToggle.js +26 -21
  28. package/components/control-bar/PlayToggle.js +85 -0
  29. package/components/control-bar/ReplayControl.js +12 -0
  30. package/components/control-bar/SettingsMenuButton.js +41 -0
  31. package/components/control-bar/SubtitleLanguagesMenuButton.js +149 -0
  32. package/components/control-bar/SubtitleMovementMenu.js +140 -0
  33. package/{control/VolumneMenuButton.js → components/control-bar/VolumeMenuButton.js} +26 -27
  34. package/components/control-bar/ZoomMenuButton.js +90 -0
  35. package/{control → components/marking-controls}/MarkInControl.js +32 -25
  36. package/{control → components/marking-controls}/MarkOutControl.js +35 -26
  37. package/components/marking-controls/MarkingAddButton.js +79 -0
  38. package/components/marking-controls/MarkingControl.js +95 -0
  39. package/components/marking-controls/MarkingDeleteButton.js +70 -0
  40. package/{control → components/marking-controls}/MarkingDuration.js +12 -5
  41. package/components/marking-controls/MarkingPreview.js +72 -0
  42. package/components/progress-bar/AudioWaveform.js +126 -0
  43. package/components/progress-bar/LoadProgressBar.js +67 -0
  44. package/components/progress-bar/MouseTimeDisplay.js +36 -0
  45. package/{control → components/progress-bar}/PlayProgressBar.js +4 -4
  46. package/components/progress-bar/ProgressControl.js +186 -0
  47. package/{control → components/progress-bar}/SeekBar.js +113 -72
  48. package/{control → components/progress-bar}/Timeline.js +43 -32
  49. package/{control/PlayBackRateControl.js → components/settings-menu-control/PlaybackRateControl.js} +44 -30
  50. package/components/settings-menu-control/SafeAreaControl.js +81 -0
  51. package/components/settings-menu-control/SettingsMenu.js +56 -0
  52. package/components/settings-menu-control/SubtitleControl.js +1 -0
  53. package/components/time-controls/CurrentTimeDisplay.js +83 -0
  54. package/{control → components/time-controls}/DurationDisplay.js +8 -15
  55. package/components/time-controls/TimeDivider.js +25 -0
  56. package/{control → components/volume-control}/VolumeBar.js +62 -80
  57. package/components/volume-control/VolumeControl.js +19 -0
  58. package/{control → components/volume-control}/VolumeLevel.js +2 -3
  59. package/components/zoom-control/ZoomBar.js +155 -0
  60. package/components/zoom-control/ZoomLevel.js +55 -0
  61. package/index.js +198 -1
  62. package/package.json +5 -8
  63. package/reducers/index.js +19 -0
  64. package/reducers/operation.js +35 -0
  65. package/reducers/player.js +222 -0
  66. package/utils/browser.js +30 -0
  67. package/utils/dom.js +1 -2
  68. package/utils/fullscreen.js +72 -0
  69. package/utils/index.js +156 -57
  70. package/Player.js +0 -945
  71. package/control/AudioTracksMenuButton.jsx +0 -80
  72. package/control/ControlBar.js +0 -303
  73. package/control/ControlBar.jsx +0 -264
  74. package/control/CurrentTimeDisplay.js +0 -34
  75. package/control/CurrentTimeDisplay.jsx +0 -35
  76. package/control/DurationDisplay.jsx +0 -48
  77. package/control/ForwardBackwardControl.js +0 -76
  78. package/control/ForwardBackwardControl.jsx +0 -79
  79. package/control/FullscreenToggle.jsx +0 -83
  80. package/control/MarkInControl.jsx +0 -109
  81. package/control/MarkOutControl.jsx +0 -131
  82. package/control/MarkerBar.jsx +0 -107
  83. package/control/MarkingControl.js +0 -82
  84. package/control/MarkingControl.jsx +0 -143
  85. package/control/MarkingPreview.js +0 -49
  86. package/control/MarkingPreview.jsx +0 -60
  87. package/control/PlayBackRateControl.jsx +0 -106
  88. package/control/PlayProgressBar.jsx +0 -92
  89. package/control/PlayToggle.js +0 -56
  90. package/control/PlayToggle.jsx +0 -57
  91. package/control/PointersBar.jsx +0 -286
  92. package/control/ProgressControl.js +0 -127
  93. package/control/ProgressControl.jsx +0 -155
  94. package/control/SeekBar.jsx +0 -229
  95. package/control/SettingsMenuButton.js +0 -63
  96. package/control/SettingsMenuButton.jsx +0 -69
  97. package/control/Slider.jsx +0 -243
  98. package/control/Timeline.jsx +0 -131
  99. package/control/VolumeBar.jsx +0 -174
  100. package/control/VolumeLevel.jsx +0 -66
  101. package/control/VolumneMenuButton.jsx +0 -111
  102. package/header/Header.jsx +0 -479
  103. package/media/AudioMeter.jsx +0 -411
  104. package/media/SDOutline.jsx +0 -90
  105. package/media/Video.js +0 -684
  106. package/media/Video.jsx +0 -714
  107. package/playlist/Playlist.js +0 -67
  108. package/playlist/Playlist.jsx +0 -91
  109. package/playlist/index.js +0 -13
  110. package/shortcuts/Shortcut.js +0 -662
  111. package/utils/Menu.jsx +0 -105
@@ -1,35 +0,0 @@
1
- import { PropTypes } from 'prop-types';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
-
5
- import { secondsToTime } from '../utils';
6
-
7
- const propTypes = {
8
- player: PropTypes.instanceOf(Object),
9
- initialTime: PropTypes.number,
10
- frameRate: PropTypes.number
11
- };
12
-
13
- const defaultProps = {
14
- player: {}
15
- };
16
-
17
- const VideoCurrentTime = styled.div`
18
- font-family: SFUIText-Regular;
19
- font-size: 12px;
20
- letter-spacing: -0.6px;
21
- color: #ffffff;
22
- min-width: 65px;
23
- text-align: left;
24
- `;
25
-
26
- const CurrentTimeDisplay = ({ currentTime, initialTime, frameRate }) => {
27
- const formattedTime = secondsToTime(currentTime.seconds, frameRate, initialTime);
28
- return <VideoCurrentTime>{formattedTime}</VideoCurrentTime>;
29
- };
30
-
31
- CurrentTimeDisplay.propTypes = propTypes;
32
- CurrentTimeDisplay.defaultProps = defaultProps;
33
- CurrentTimeDisplay.displayName = 'CurrentTimeDisplay';
34
-
35
- export default CurrentTimeDisplay;
@@ -1,48 +0,0 @@
1
- import { PropTypes } from 'prop-types';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
-
5
- import { secondsToTime } from '../utils';
6
-
7
- const propTypes = {
8
- player: PropTypes.instanceOf(Object),
9
- frameRate: PropTypes.number,
10
- separator: PropTypes.string
11
- };
12
-
13
- const defaultProps = {
14
- player: {}
15
- };
16
-
17
- const VideoTotalDuration = styled.div`
18
- font-family: SFUIText-Regular;
19
- font-size: 12px;
20
- letter-spacing: -0.6px;
21
- margin: 0 2px;
22
- color: #888888;
23
- `;
24
-
25
- const TimeSeperator = styled.div`
26
- color: #888888;
27
- margin: 0 2px;
28
- font-family: SFUIText-Regular;
29
- font-size: 12px;
30
- letter-spacing: -0.6px;
31
- `;
32
-
33
- function DurationDisplay({ duration, frameRate, separator }) {
34
- const formattedTime = secondsToTime(duration.seconds, frameRate);
35
- const separatorText = separator || '/';
36
- return (
37
- <>
38
- <TimeSeperator dir="ltr">{separatorText}</TimeSeperator>
39
- <VideoTotalDuration>{formattedTime}</VideoTotalDuration>
40
- </>
41
- );
42
- }
43
-
44
- DurationDisplay.propTypes = propTypes;
45
- DurationDisplay.defaultProps = defaultProps;
46
- DurationDisplay.displayName = 'DurationDisplay';
47
-
48
- export default DurationDisplay;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = require("prop-types");
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
10
- var _components = require("@desynova-digital/components");
11
- var _templateObject,
12
- _this = void 0;
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
15
- var ForwardReplayButton = (0, _styledComponents["default"])(_components.Button)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n margin: 0 10px;\n &:hover,\n &:focus {\n background: transparent;\n }\n"])));
16
- var propTypes = {
17
- actions: _propTypes.PropTypes.instanceOf(Object),
18
- seconds: _propTypes.PropTypes.number
19
- };
20
- var defaultProps = {
21
- actions: {},
22
- seconds: 0.04
23
- };
24
- var ForwardBackWardComponent = function ForwardBackWardComponent(_ref) {
25
- var mode = _ref.mode,
26
- seconds = _ref.seconds,
27
- actionClick = _ref.actionClick;
28
- var getIcon = function getIcon() {
29
- var icon = '';
30
- if (mode === 'forward') {
31
- if (seconds === 10) {
32
- icon = 'forward-10';
33
- } else {
34
- icon = 'triangle-double-right';
35
- }
36
- } else {
37
- if (seconds === 10) {
38
- icon = 'rewind-10';
39
- } else {
40
- icon = 'triangle-double-left';
41
- }
42
- }
43
- return icon;
44
- };
45
- var handleClick = function handleClick() {
46
- // Depends mode to implement different actions
47
- if (mode === 'forward') {
48
- actionClick({
49
- action: 'add_seconds',
50
- value: seconds
51
- });
52
- } else {
53
- actionClick({
54
- action: 'add_seconds',
55
- value: -seconds
56
- });
57
- }
58
- };
59
- return /*#__PURE__*/_react["default"].createElement(ForwardReplayButton, {
60
- display: "rounded",
61
- appearance: "cta",
62
- icon: getIcon(),
63
- iconWidth: seconds === 10 ? 22 : 14,
64
- iconHeight: seconds === 10 ? 22 : 14,
65
- width: 20,
66
- height: 20,
67
- ref: function ref(c) {
68
- _this.button = c;
69
- },
70
- onClick: handleClick
71
- });
72
- };
73
- ForwardBackWardComponent.propTypes = propTypes;
74
- ForwardBackWardComponent.defaultProps = defaultProps;
75
- var _default = ForwardBackWardComponent;
76
- exports["default"] = _default;
@@ -1,79 +0,0 @@
1
- import React from 'react';
2
- import { PropTypes } from 'prop-types';
3
- import styled from 'styled-components';
4
- import { Button } from '@desynova-digital/components';
5
-
6
- const ForwardReplayButton = styled(Button)`
7
- background: transparent;
8
- border: none;
9
- margin: 0 10px;
10
- &:hover,
11
- &:focus {
12
- background: transparent;
13
- }
14
- `;
15
-
16
- const propTypes = {
17
- actions: PropTypes.instanceOf(Object),
18
- seconds: PropTypes.number
19
- };
20
-
21
- const defaultProps = {
22
- actions: {},
23
- seconds: 0.04
24
- };
25
-
26
- const ForwardBackWardComponent = ({ mode, seconds, actionClick }) => {
27
- const getIcon = () => {
28
- let icon = '';
29
- if (mode === 'forward') {
30
- if (seconds === 10) {
31
- icon = 'forward-10';
32
- } else {
33
- icon = 'triangle-double-right';
34
- }
35
- } else {
36
- if (seconds === 10) {
37
- icon = 'rewind-10';
38
- } else {
39
- icon = 'triangle-double-left';
40
- }
41
- }
42
- return icon;
43
- };
44
-
45
- const handleClick = () => {
46
- // Depends mode to implement different actions
47
- if (mode === 'forward') {
48
- actionClick({
49
- action: 'add_seconds',
50
- value: seconds
51
- });
52
- } else {
53
- actionClick({
54
- action: 'add_seconds',
55
- value: -seconds
56
- });
57
- }
58
- };
59
-
60
- return (
61
- <ForwardReplayButton
62
- display="rounded"
63
- appearance="cta"
64
- icon={getIcon()}
65
- iconWidth={seconds === 10 ? 22 : 14}
66
- iconHeight={seconds === 10 ? 22 : 14}
67
- width={20}
68
- height={20}
69
- ref={(c) => {
70
- this.button = c;
71
- }}
72
- onClick={handleClick}
73
- />
74
- );
75
- };
76
-
77
- ForwardBackWardComponent.propTypes = propTypes;
78
- ForwardBackWardComponent.defaultProps = defaultProps;
79
- export default ForwardBackWardComponent;
@@ -1,83 +0,0 @@
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';
@@ -1,109 +0,0 @@
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';
@@ -1,131 +0,0 @@
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';
@@ -1,107 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { PropTypes } from 'prop-types';
3
- import styled from 'styled-components';
4
- import { Icon } from '@desynova-digital/components';
5
- /*
6
- * import { colors } from '@desynova-digital/tokens';
7
- * import colors from '../colors';
8
- */
9
-
10
- const propTypes = {
11
- player: PropTypes.instanceOf(Object),
12
- controlType: PropTypes.string
13
- };
14
-
15
- const defaultProps = {
16
- player: {}
17
- };
18
-
19
- const MarkerBlock = styled.div`
20
- width: 100%;
21
- height: 30px;
22
- position: ${(props) => (props.controlType === 'advanced' && !props.isFullscreen ? 'relative' : 'absolute')};
23
- bottom: ${(props) => (props.controlType === 'advanced' && !props.isFullscreen ? '0px' : '5px')};
24
- .marker {
25
- position: absolute;
26
- width: 2px;
27
- height: 20px;
28
- p {
29
- font-family: SFUIText-Medium;
30
- font-size: 10px;
31
- color: #ffffff;
32
- position: absolute;
33
- left: 50%;
34
- transform: translateX(-50%);
35
- }
36
- ${Icon.Element} {
37
- position: absolute;
38
- display: block;
39
- left: 50%;
40
- top: 10px;
41
- transform: translateX(-50%);
42
- }
43
- }
44
- `;
45
-
46
- export default class MarkerBar extends Component {
47
- constructor(props) {
48
- super(props);
49
- this.getMarkerPosition = this.getMarkerPosition.bind(this);
50
- this.getTimePos = this.getTimePos.bind(this);
51
- }
52
-
53
- getMarkerPosition(timePos) {
54
- const {
55
- duration: { seconds }
56
- } = this.props;
57
- const percent = timePos / seconds;
58
- return percent >= 1 ? 1 : percent;
59
- }
60
-
61
- getTimePos(markerPos) {
62
- const leftMarker = document.getElementsByClassName('marker-left')[0];
63
- const rightMarker = document.getElementsByClassName('marker-right')[0];
64
- if (leftMarker && rightMarker) {
65
- const leftOffset = leftMarker.offsetLeft;
66
- const rightOffset = rightMarker.offsetLeft;
67
- const offsetDiff = rightOffset - leftOffset;
68
- let position = '50%';
69
- if (offsetDiff < 61) {
70
- switch (markerPos) {
71
- case 'left':
72
- position = '-20px';
73
- break;
74
- case 'right':
75
- position = '20px';
76
- break;
77
- }
78
- }
79
- return position;
80
- }
81
- }
82
-
83
- render() {
84
- const { isFullscreen, controlType, playerSelectedMarker } = this.props;
85
- const leftMarkerPosition = `${(this.getMarkerPosition(playerSelectedMarker.leftMarker) * 100).toFixed(2)}%`;
86
- const rightMarkerPosition = `${(this.getMarkerPosition(playerSelectedMarker.rightMarker) * 100).toFixed(2)}%`;
87
-
88
- return (
89
- <MarkerBlock controlType={controlType} isFullscreen={isFullscreen}>
90
- {playerSelectedMarker.leftMarker > -1 ? (
91
- <div className="marker marker-left" style={{ left: leftMarkerPosition }}>
92
- <Icon name="marker" width={8} height={7} color="#00cec6" />
93
- </div>
94
- ) : null}
95
- {playerSelectedMarker.rightMarker > -1 ? (
96
- <div className="marker marker-right" style={{ left: rightMarkerPosition }}>
97
- <Icon name="marker" width={8} height={7} color="#00cec6" />
98
- </div>
99
- ) : null}
100
- </MarkerBlock>
101
- );
102
- }
103
- }
104
-
105
- MarkerBar.propTypes = propTypes;
106
- MarkerBar.defaultProps = defaultProps;
107
- MarkerBar.displayName = 'MarkerBar';