@desynova-digital/player 4.0.1 → 4.0.2
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/Manager.js +99 -0
- package/actions/player.js +331 -0
- package/actions/video.js +206 -0
- package/{utils/colors.js → colors.js} +1 -2
- package/{media → components}/AudioMeter.js +96 -109
- package/components/BigPlayButton.js +84 -0
- package/components/ImageViewer.js +272 -0
- package/{control → components}/MarkerBar.js +33 -24
- package/{utils → components}/Menu.js +13 -4
- package/components/Player.js +706 -0
- package/{header/Header.js → components/PlayerHeader.js} +104 -78
- package/components/Playlist.js +95 -0
- package/{control → components}/PointersBar.js +122 -61
- package/components/PosterImage.js +50 -0
- package/{media → components}/SDOutline.js +13 -49
- package/components/Shortcut.js +821 -0
- package/{control → components}/Slider.js +27 -23
- package/components/TagsBar.js +81 -0
- package/components/Video.js +1280 -0
- package/{control → components/control-bar}/AudioTracksMenuButton.js +32 -28
- package/components/control-bar/CameraButton.js +75 -0
- package/components/control-bar/CommentsButton.js +186 -0
- package/components/control-bar/ControlBar.js +266 -0
- package/components/control-bar/EditorControlMenuButton.js +317 -0
- package/components/control-bar/ForwardControl.js +12 -0
- package/components/control-bar/ForwardReplayControl.js +106 -0
- package/{control → components/control-bar}/FullscreenToggle.js +26 -21
- package/components/control-bar/PlayToggle.js +85 -0
- package/components/control-bar/ReplayControl.js +12 -0
- package/components/control-bar/SettingsMenuButton.js +41 -0
- package/components/control-bar/SubtitleLanguagesMenuButton.js +149 -0
- package/components/control-bar/SubtitleMovementMenu.js +140 -0
- package/{control/VolumneMenuButton.js → components/control-bar/VolumeMenuButton.js} +26 -27
- package/components/control-bar/ZoomMenuButton.js +90 -0
- package/{control → components/marking-controls}/MarkInControl.js +32 -25
- package/{control → components/marking-controls}/MarkOutControl.js +35 -26
- package/components/marking-controls/MarkingAddButton.js +79 -0
- package/components/marking-controls/MarkingControl.js +95 -0
- package/components/marking-controls/MarkingDeleteButton.js +70 -0
- package/{control → components/marking-controls}/MarkingDuration.js +12 -5
- package/components/marking-controls/MarkingPreview.js +72 -0
- package/components/progress-bar/AudioWaveform.js +126 -0
- package/components/progress-bar/LoadProgressBar.js +67 -0
- package/components/progress-bar/MouseTimeDisplay.js +36 -0
- package/{control → components/progress-bar}/PlayProgressBar.js +4 -4
- package/components/progress-bar/ProgressControl.js +186 -0
- package/{control → components/progress-bar}/SeekBar.js +113 -72
- package/{control → components/progress-bar}/Timeline.js +43 -32
- package/{control/PlayBackRateControl.js → components/settings-menu-control/PlaybackRateControl.js} +44 -30
- package/components/settings-menu-control/SafeAreaControl.js +81 -0
- package/components/settings-menu-control/SettingsMenu.js +56 -0
- package/components/settings-menu-control/SubtitleControl.js +1 -0
- package/components/time-controls/CurrentTimeDisplay.js +83 -0
- package/{control → components/time-controls}/DurationDisplay.js +8 -15
- package/components/time-controls/TimeDivider.js +25 -0
- package/{control → components/volume-control}/VolumeBar.js +62 -80
- package/components/volume-control/VolumeControl.js +19 -0
- package/{control → components/volume-control}/VolumeLevel.js +2 -3
- package/components/zoom-control/ZoomBar.js +155 -0
- package/components/zoom-control/ZoomLevel.js +55 -0
- package/index.js +198 -1
- package/package.json +5 -8
- package/reducers/index.js +19 -0
- package/reducers/operation.js +35 -0
- package/reducers/player.js +222 -0
- package/utils/browser.js +30 -0
- package/utils/dom.js +1 -2
- package/utils/fullscreen.js +72 -0
- package/utils/index.js +156 -57
- package/Player.js +0 -945
- package/control/AudioTracksMenuButton.jsx +0 -80
- package/control/ControlBar.js +0 -303
- package/control/ControlBar.jsx +0 -264
- package/control/CurrentTimeDisplay.js +0 -34
- package/control/CurrentTimeDisplay.jsx +0 -35
- package/control/DurationDisplay.jsx +0 -48
- package/control/ForwardBackwardControl.js +0 -76
- package/control/ForwardBackwardControl.jsx +0 -79
- package/control/FullscreenToggle.jsx +0 -83
- package/control/MarkInControl.jsx +0 -109
- package/control/MarkOutControl.jsx +0 -131
- package/control/MarkerBar.jsx +0 -107
- package/control/MarkingControl.js +0 -82
- package/control/MarkingControl.jsx +0 -143
- package/control/MarkingPreview.js +0 -49
- package/control/MarkingPreview.jsx +0 -60
- package/control/PlayBackRateControl.jsx +0 -106
- package/control/PlayProgressBar.jsx +0 -92
- package/control/PlayToggle.js +0 -56
- package/control/PlayToggle.jsx +0 -57
- package/control/PointersBar.jsx +0 -286
- package/control/ProgressControl.js +0 -127
- package/control/ProgressControl.jsx +0 -155
- package/control/SeekBar.jsx +0 -229
- package/control/SettingsMenuButton.js +0 -63
- package/control/SettingsMenuButton.jsx +0 -69
- package/control/Slider.jsx +0 -243
- package/control/Timeline.jsx +0 -131
- package/control/VolumeBar.jsx +0 -174
- package/control/VolumeLevel.jsx +0 -66
- package/control/VolumneMenuButton.jsx +0 -111
- package/header/Header.jsx +0 -479
- package/media/AudioMeter.jsx +0 -411
- package/media/SDOutline.jsx +0 -90
- package/media/Video.js +0 -684
- package/media/Video.jsx +0 -714
- package/playlist/Playlist.js +0 -67
- package/playlist/Playlist.jsx +0 -91
- package/playlist/index.js +0 -13
- package/shortcuts/Shortcut.js +0 -662
- package/utils/Menu.jsx +0 -105
package/control/Timeline.jsx
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { findDOMNode } from 'react-dom';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { PropTypes } from 'prop-types';
|
|
5
|
-
import { Icon } from '@desynova-digital/components';
|
|
6
|
-
import { secondsToTime } from '../utils';
|
|
7
|
-
|
|
8
|
-
const propTypes = {
|
|
9
|
-
player: PropTypes.instanceOf(Object),
|
|
10
|
-
initialTime: PropTypes.number,
|
|
11
|
-
frameRate: PropTypes.number
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const TimelineBlock = styled.div`
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
align-items: stretch;
|
|
18
|
-
position: absolute;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
top: 0px;
|
|
22
|
-
left: 0;
|
|
23
|
-
.player-time {
|
|
24
|
-
width: 100%;
|
|
25
|
-
position: relative;
|
|
26
|
-
height: 46px;
|
|
27
|
-
user-select: none;
|
|
28
|
-
&:first-child {
|
|
29
|
-
p {
|
|
30
|
-
left: 0px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
&:last-child {
|
|
34
|
-
width: 10px;
|
|
35
|
-
${Icon.Element} {
|
|
36
|
-
display: none;
|
|
37
|
-
}
|
|
38
|
-
p {
|
|
39
|
-
left: auto;
|
|
40
|
-
right: 0px;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
${Icon.Element} {
|
|
44
|
-
position: absolute;
|
|
45
|
-
left: 0;
|
|
46
|
-
bottom: 0;
|
|
47
|
-
}
|
|
48
|
-
p {
|
|
49
|
-
color: #aaa;
|
|
50
|
-
font-size: 10px;
|
|
51
|
-
font-family: SFUIText-Regular;
|
|
52
|
-
left: -28px;
|
|
53
|
-
top: 10px;
|
|
54
|
-
letter-spacing: 0.5px;
|
|
55
|
-
position: absolute;
|
|
56
|
-
user-select: none;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
export default class Timeline extends Component {
|
|
62
|
-
constructor(props, context) {
|
|
63
|
-
super(props, context);
|
|
64
|
-
this.state = {
|
|
65
|
-
timeArray: []
|
|
66
|
-
};
|
|
67
|
-
this.generateTimeline = this.generateTimeline.bind(this);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
componentDidMount() {
|
|
71
|
-
this.generateTimeline();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
componentDidUpdate(prevProps, prevState) {
|
|
75
|
-
if (prevProps.duration?.seconds !== this.props.duration?.seconds) {
|
|
76
|
-
this.generateTimeline();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
generateTimeline() {
|
|
81
|
-
const {
|
|
82
|
-
duration: { seconds }
|
|
83
|
-
} = this.props;
|
|
84
|
-
const timelineBlock = findDOMNode(this.timelineBlock);
|
|
85
|
-
const perTimeWidth = 100;
|
|
86
|
-
const sliderWidth = timelineBlock.offsetWidth;
|
|
87
|
-
const timeBlocks = parseInt(sliderWidth / perTimeWidth, 10);
|
|
88
|
-
const timeDistance = parseInt(seconds / timeBlocks, 10);
|
|
89
|
-
const timeArray = [0];
|
|
90
|
-
for (let i = 0; i < timeBlocks; i++) {
|
|
91
|
-
const lastValue = timeArray[timeArray.length - 1];
|
|
92
|
-
const currentTime = lastValue + timeDistance;
|
|
93
|
-
if (currentTime + timeDistance < seconds) {
|
|
94
|
-
timeArray.push(currentTime);
|
|
95
|
-
} else {
|
|
96
|
-
timeArray.push(seconds);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
this.setState({ timeArray });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
render() {
|
|
104
|
-
const { initialTime, frameRate } = this.props;
|
|
105
|
-
const { timeArray } = this.state;
|
|
106
|
-
return (
|
|
107
|
-
<TimelineBlock
|
|
108
|
-
ref={(c) => {
|
|
109
|
-
this.timelineBlock = c;
|
|
110
|
-
}}>
|
|
111
|
-
{timeArray.map((time) => {
|
|
112
|
-
const formattedTime = secondsToTime(time, frameRate, initialTime);
|
|
113
|
-
return (
|
|
114
|
-
<div
|
|
115
|
-
className="player-time"
|
|
116
|
-
ref={(c) => {
|
|
117
|
-
this.timelineContainer = c;
|
|
118
|
-
}}
|
|
119
|
-
key={time}>
|
|
120
|
-
<p>{formattedTime}</p>
|
|
121
|
-
<Icon name="timeline" stroke="#aaa" />
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
})}
|
|
125
|
-
</TimelineBlock>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
Timeline.propTypes = propTypes;
|
|
131
|
-
Timeline.displayName = 'Timeline';
|
package/control/VolumeBar.jsx
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'prop-types';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
// import VolumeLevel from './VolumeLevel';
|
|
5
|
-
import colors from '../utils/colors';
|
|
6
|
-
import Slider from './Slider';
|
|
7
|
-
|
|
8
|
-
const propTypes = {
|
|
9
|
-
actions: PropTypes.instanceOf(Object),
|
|
10
|
-
player: PropTypes.instanceOf(Object),
|
|
11
|
-
vertical: PropTypes.bool,
|
|
12
|
-
onFocus: PropTypes.func,
|
|
13
|
-
onBlur: PropTypes.func
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
actions: {},
|
|
18
|
-
player: {},
|
|
19
|
-
vertical: false,
|
|
20
|
-
onFocus: null,
|
|
21
|
-
onBlur: null,
|
|
22
|
-
percentage: '100%',
|
|
23
|
-
vertical: false
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const VolumeControlBar = styled.div`
|
|
27
|
-
height: 85%;
|
|
28
|
-
position: absolute;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
width: 2px;
|
|
32
|
-
margin: 0 auto;
|
|
33
|
-
top: 50%;
|
|
34
|
-
left: 50%;
|
|
35
|
-
transform: translate(-50%, -50%);
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
const VolumeLevelBar = styled.div`
|
|
39
|
-
position: absolute;
|
|
40
|
-
width: ${(props) => (props.vertical ? '100%' : '0px')};
|
|
41
|
-
height: ${(props) => (props.vertical ? '0' : '100%')};
|
|
42
|
-
left: 0;
|
|
43
|
-
top: ${(props) => (props.vertical ? 'initial' : '0px')};
|
|
44
|
-
bottom: ${(props) => (props.vertical ? '0px' : 'initial')};
|
|
45
|
-
background: ${(props) => colors.common.video[props.assetType].base};
|
|
46
|
-
&:after {
|
|
47
|
-
content: '';
|
|
48
|
-
width: 8px;
|
|
49
|
-
height: 8px;
|
|
50
|
-
position: absolute;
|
|
51
|
-
background: ${(props) => colors.common.video[props.assetType].base};
|
|
52
|
-
border-radius: 100%;
|
|
53
|
-
right: -3px;
|
|
54
|
-
top: -4px;
|
|
55
|
-
box-shadow: 0 0 14px 1px ${(props) => colors.common.video[props.assetType].base};
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
class VolumeBar extends Component {
|
|
60
|
-
constructor(props, context) {
|
|
61
|
-
super(props, context);
|
|
62
|
-
|
|
63
|
-
this.state = {
|
|
64
|
-
percentage: '0%'
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
this.handleMouseMove = this.handleMouseMove.bind(this);
|
|
68
|
-
this.handlePercentageChange = this.handlePercentageChange.bind(this);
|
|
69
|
-
this.checkMuted = this.checkMuted.bind(this);
|
|
70
|
-
this.getPercent = this.getPercent.bind(this);
|
|
71
|
-
this.stepForward = this.stepForward.bind(this);
|
|
72
|
-
this.stepBack = this.stepBack.bind(this);
|
|
73
|
-
// this.handleFocus = this.handleFocus.bind(this);
|
|
74
|
-
// this.handleBlur = this.handleBlur.bind(this);
|
|
75
|
-
this.handleClick = this.handleClick.bind(this);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
componentDidMount() {}
|
|
79
|
-
|
|
80
|
-
getPercent() {
|
|
81
|
-
const { muted, volume } = this.props;
|
|
82
|
-
if (muted) {
|
|
83
|
-
return 0;
|
|
84
|
-
}
|
|
85
|
-
return volume;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
checkMuted() {
|
|
89
|
-
const { actionClick, muted } = this.props;
|
|
90
|
-
if (muted) {
|
|
91
|
-
actionClick({
|
|
92
|
-
action: 'mute',
|
|
93
|
-
value: false
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
handleMouseMove(event) {
|
|
99
|
-
const { actionClick } = this.props;
|
|
100
|
-
this.checkMuted();
|
|
101
|
-
const distance = this.slider.calculateDistance(event);
|
|
102
|
-
actionClick({
|
|
103
|
-
action: 'volume',
|
|
104
|
-
value: distance
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
stepForward() {
|
|
109
|
-
const { volume } = this.props;
|
|
110
|
-
this.checkMuted();
|
|
111
|
-
actions.changeVolume(volume + 0.1);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
stepBack() {
|
|
115
|
-
const { volume } = this.props;
|
|
116
|
-
this.checkMuted();
|
|
117
|
-
actions.changeVolume(volume - 0.1);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
handlePercentageChange(percent) {
|
|
121
|
-
const { percentage } = this.state;
|
|
122
|
-
if (percent !== percentage) {
|
|
123
|
-
this.setState({
|
|
124
|
-
percentage: percent
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
handleClick(event) {
|
|
130
|
-
event.stopPropagation();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
render() {
|
|
134
|
-
const { vertical, assetType, playerType, volume } = this.props;
|
|
135
|
-
const style = {};
|
|
136
|
-
if (vertical) {
|
|
137
|
-
style.height = this.getPercent() * 100;
|
|
138
|
-
} else {
|
|
139
|
-
style.width = this.getPercent() * 100;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const volumeData = (volume * 100).toFixed(2);
|
|
143
|
-
return (
|
|
144
|
-
<VolumeControlBar>
|
|
145
|
-
<Slider
|
|
146
|
-
ref={(c) => {
|
|
147
|
-
this.slider = c;
|
|
148
|
-
}}
|
|
149
|
-
label="volume level"
|
|
150
|
-
valuenow={volumeData}
|
|
151
|
-
valuetext={`${volumeData}%`}
|
|
152
|
-
onMouseMove={this.handleMouseMove}
|
|
153
|
-
onFocus={this.handleFocus}
|
|
154
|
-
onBlur={this.handleBlur}
|
|
155
|
-
onClick={this.handleClick}
|
|
156
|
-
sliderActive={this.handleFocus}
|
|
157
|
-
sliderInactive={this.handleBlur}
|
|
158
|
-
getPercent={this.getPercent}
|
|
159
|
-
onPercentageChange={this.handlePercentageChange}
|
|
160
|
-
stepForward={this.stepForward}
|
|
161
|
-
stepBack={this.stepBack}
|
|
162
|
-
{...this.props}>
|
|
163
|
-
<VolumeLevelBar style={style} assetType={assetType} playerType={playerType} vertical={vertical} />
|
|
164
|
-
</Slider>
|
|
165
|
-
</VolumeControlBar>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
VolumeBar.propTypes = propTypes;
|
|
171
|
-
VolumeBar.defaultProps = defaultProps;
|
|
172
|
-
VolumeBar.displayName = 'VolumeBar';
|
|
173
|
-
|
|
174
|
-
export default VolumeBar;
|
package/control/VolumeLevel.jsx
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import colors from '../../colors';
|
|
5
|
-
|
|
6
|
-
const propTypes = {
|
|
7
|
-
playerType: PropTypes.oneOf([
|
|
8
|
-
'dubbing_review',
|
|
9
|
-
'clipping_default',
|
|
10
|
-
'default',
|
|
11
|
-
'tagging',
|
|
12
|
-
'qc',
|
|
13
|
-
'subtitle',
|
|
14
|
-
'snp_edit',
|
|
15
|
-
'archive',
|
|
16
|
-
'restore',
|
|
17
|
-
'clipping',
|
|
18
|
-
'storyboard',
|
|
19
|
-
'panel'
|
|
20
|
-
]),
|
|
21
|
-
assetType: PropTypes.oneOf(['fc', 'rc']),
|
|
22
|
-
percentage: PropTypes.string,
|
|
23
|
-
vertical: PropTypes.bool
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const defaultProps = {
|
|
27
|
-
percentage: '100%',
|
|
28
|
-
vertical: false
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const VolumeLevelBar = styled.div`
|
|
32
|
-
position: absolute;
|
|
33
|
-
width: ${(props) => (props.vertical ? '100%' : '0px')};
|
|
34
|
-
height: ${(props) => (props.vertical ? '0' : '100%')};
|
|
35
|
-
left: 0;
|
|
36
|
-
top: ${(props) => (props.vertical ? 'initial' : '0px')};
|
|
37
|
-
bottom: ${(props) => (props.vertical ? '0px' : 'initial')};
|
|
38
|
-
background: ${(props) => colors.common.video[props.assetType].base};
|
|
39
|
-
&:after {
|
|
40
|
-
content: '';
|
|
41
|
-
width: 8px;
|
|
42
|
-
height: 8px;
|
|
43
|
-
position: absolute;
|
|
44
|
-
background: ${(props) => colors.common.video[props.assetType].base};
|
|
45
|
-
border-radius: 100%;
|
|
46
|
-
right: -3px;
|
|
47
|
-
top: -4px;
|
|
48
|
-
box-shadow: 0 0 14px 1px ${(props) => colors.common.video[props.assetType].base};
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
function VolumeLevel({ percentage, vertical, assetType, playerType }) {
|
|
53
|
-
const style = {};
|
|
54
|
-
if (vertical) {
|
|
55
|
-
style.height = percentage;
|
|
56
|
-
} else {
|
|
57
|
-
style.width = percentage;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return <VolumeLevelBar style={style} assetType={assetType} playerType={playerType} vertical={vertical} />;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
VolumeLevel.propTypes = propTypes;
|
|
64
|
-
VolumeLevel.defaultProps = defaultProps;
|
|
65
|
-
VolumeLevel.displayName = 'VolumeLevel';
|
|
66
|
-
export default VolumeLevel;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'prop-types';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Button } from '@desynova-digital/components';
|
|
5
|
-
import VolumeBar from './VolumeBar';
|
|
6
|
-
|
|
7
|
-
const propTypes = {
|
|
8
|
-
player: PropTypes.instanceOf(Object),
|
|
9
|
-
actions: PropTypes.instanceOf(Object),
|
|
10
|
-
style: PropTypes.instanceOf(Object)
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const defaultProps = {
|
|
14
|
-
player: {},
|
|
15
|
-
actions: {},
|
|
16
|
-
style: {}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const VolumeMenu = styled.div`
|
|
20
|
-
width: 20px;
|
|
21
|
-
position: relative;
|
|
22
|
-
.volume-control-bar {
|
|
23
|
-
width: 30px;
|
|
24
|
-
height: 0px;
|
|
25
|
-
position: absolute;
|
|
26
|
-
bottom: 20px;
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
transition: all 0.5s ease-in-out;
|
|
29
|
-
z-index: 10;
|
|
30
|
-
left: 50%;
|
|
31
|
-
transform: translateX(-50%);
|
|
32
|
-
padding: 0;
|
|
33
|
-
}
|
|
34
|
-
&:hover {
|
|
35
|
-
.volume-control-bar {
|
|
36
|
-
height: 120px;
|
|
37
|
-
overflow: visible;
|
|
38
|
-
padding: 15px;
|
|
39
|
-
}
|
|
40
|
-
svg path {
|
|
41
|
-
fill: #00cec6;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
const VolumeButton = styled(Button)`
|
|
47
|
-
background: transparent;
|
|
48
|
-
border: none;
|
|
49
|
-
margin: 0px;
|
|
50
|
-
&:hover,
|
|
51
|
-
&:focus {
|
|
52
|
-
background: transparent;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
class VolumeMenuButton extends Component {
|
|
57
|
-
constructor(props, context) {
|
|
58
|
-
super(props, context);
|
|
59
|
-
|
|
60
|
-
this.handleClick = this.handleClick.bind(this);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get volumeLevel() {
|
|
64
|
-
const { volume, muted } = this.props;
|
|
65
|
-
let level = 3;
|
|
66
|
-
if (volume === 0 || muted) {
|
|
67
|
-
level = 0;
|
|
68
|
-
} else if (volume < 0.33) {
|
|
69
|
-
level = 1;
|
|
70
|
-
} else if (volume < 0.67) {
|
|
71
|
-
level = 2;
|
|
72
|
-
}
|
|
73
|
-
return level;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
handleClick() {
|
|
77
|
-
const { actionClick, muted } = this.props;
|
|
78
|
-
actionClick({
|
|
79
|
-
action: 'mute',
|
|
80
|
-
value: !muted
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
render() {
|
|
85
|
-
const { style } = this.props;
|
|
86
|
-
// const level = this.volumeLevel;
|
|
87
|
-
const vertical = true;
|
|
88
|
-
return (
|
|
89
|
-
<VolumeMenu style={style}>
|
|
90
|
-
<VolumeButton
|
|
91
|
-
display="rounded"
|
|
92
|
-
appearance="cta"
|
|
93
|
-
icon="volume"
|
|
94
|
-
iconWidth={18}
|
|
95
|
-
iconHeight={18}
|
|
96
|
-
width={20}
|
|
97
|
-
height={20}
|
|
98
|
-
onClick={this.handleClick}
|
|
99
|
-
/>
|
|
100
|
-
<div className="volume-control-bar">
|
|
101
|
-
<VolumeBar onFocus={this.handleFocus} onBlur={this.handleBlur} vertical={vertical} {...this.props} />
|
|
102
|
-
</div>
|
|
103
|
-
</VolumeMenu>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
VolumeMenuButton.propTypes = propTypes;
|
|
109
|
-
VolumeMenuButton.defaultProps = defaultProps;
|
|
110
|
-
VolumeMenuButton.displayName = 'VolumeMenuButton';
|
|
111
|
-
export default VolumeMenuButton;
|