@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.
- package/Player.js +945 -0
- package/control/AudioTracksMenuButton.js +91 -0
- package/control/AudioTracksMenuButton.jsx +80 -0
- package/control/ControlBar.js +303 -0
- package/control/ControlBar.jsx +264 -0
- package/control/CurrentTimeDisplay.js +34 -0
- package/control/CurrentTimeDisplay.jsx +35 -0
- package/control/DurationDisplay.js +38 -0
- package/control/DurationDisplay.jsx +48 -0
- package/control/ForwardBackwardControl.js +76 -0
- package/control/ForwardBackwardControl.jsx +79 -0
- package/control/FullscreenToggle.js +82 -0
- package/control/FullscreenToggle.jsx +83 -0
- package/control/MarkInControl.js +124 -0
- package/control/MarkInControl.jsx +109 -0
- package/control/MarkOutControl.js +137 -0
- package/control/MarkOutControl.jsx +131 -0
- package/control/MarkerBar.js +127 -0
- package/control/MarkerBar.jsx +107 -0
- package/control/MarkingControl.js +82 -0
- package/control/MarkingControl.jsx +143 -0
- package/control/MarkingDuration.js +44 -0
- package/control/MarkingPreview.js +49 -0
- package/control/MarkingPreview.jsx +60 -0
- package/control/PlayBackRateControl.js +106 -0
- package/control/PlayBackRateControl.jsx +106 -0
- package/control/PlayProgressBar.js +61 -0
- package/control/PlayProgressBar.jsx +92 -0
- package/control/PlayToggle.js +56 -0
- package/control/PlayToggle.jsx +57 -0
- package/control/PointersBar.js +231 -0
- package/control/PointersBar.jsx +286 -0
- package/control/ProgressControl.js +127 -0
- package/control/ProgressControl.jsx +155 -0
- package/control/SeekBar.js +204 -0
- package/control/SeekBar.jsx +229 -0
- package/control/SettingsMenuButton.js +63 -0
- package/control/SettingsMenuButton.jsx +69 -0
- package/control/Slider.js +274 -0
- package/control/Slider.jsx +243 -0
- package/control/Timeline.js +118 -0
- package/control/Timeline.jsx +131 -0
- package/control/VolumeBar.js +198 -0
- package/control/VolumeBar.jsx +174 -0
- package/control/VolumeLevel.js +61 -0
- package/control/VolumeLevel.jsx +66 -0
- package/control/VolumneMenuButton.js +112 -0
- package/control/VolumneMenuButton.jsx +111 -0
- package/header/Header.js +309 -0
- package/header/Header.jsx +479 -0
- package/index.js +9 -151
- package/media/AudioMeter.js +381 -0
- package/media/AudioMeter.jsx +411 -0
- package/media/SDOutline.js +82 -0
- package/media/SDOutline.jsx +90 -0
- package/media/Video.js +684 -0
- package/media/Video.jsx +714 -0
- package/package.json +5 -1
- package/playlist/Playlist.js +67 -0
- package/playlist/Playlist.jsx +91 -0
- package/playlist/index.js +13 -0
- package/shortcuts/Shortcut.js +662 -0
- package/utils/Menu.js +50 -0
- package/utils/Menu.jsx +105 -0
- package/{colors.js → utils/colors.js} +13 -13
- package/utils/dom.js +6 -16
- package/utils/index.js +52 -122
- package/Manager.js +0 -124
- package/actions/player.js +0 -375
- package/actions/video.js +0 -230
- package/components/AudioMeter.js +0 -414
- package/components/BigPlayButton.js +0 -110
- package/components/ImageViewer.js +0 -318
- package/components/MarkerBar.js +0 -138
- package/components/Menu.js +0 -77
- package/components/Player.js +0 -821
- package/components/PlayerHeader.js +0 -472
- package/components/Playlist.js +0 -133
- package/components/PointersBar.js +0 -299
- package/components/PosterImage.js +0 -61
- package/components/SDOutline.js +0 -68
- package/components/Shortcut.js +0 -621
- package/components/Slider.js +0 -317
- package/components/TagsBar.js +0 -100
- package/components/Video.js +0 -1431
- package/components/control-bar/AudioTracksMenuButton.js +0 -113
- package/components/control-bar/CameraButton.js +0 -88
- package/components/control-bar/CommentsButton.js +0 -216
- package/components/control-bar/ControlBar.js +0 -260
- package/components/control-bar/EditorControlMenuButton.js +0 -412
- package/components/control-bar/ForwardControl.js +0 -17
- package/components/control-bar/ForwardReplayControl.js +0 -122
- package/components/control-bar/FullscreenToggle.js +0 -101
- package/components/control-bar/PlayToggle.js +0 -98
- package/components/control-bar/ReplayControl.js +0 -17
- package/components/control-bar/SettingsMenuButton.js +0 -43
- package/components/control-bar/SubtitleLanguagesMenuButton.js +0 -174
- package/components/control-bar/VolumeMenuButton.js +0 -134
- package/components/control-bar/ZoomMenuButton.js +0 -116
- package/components/marking-controls/MarkInControl.js +0 -140
- package/components/marking-controls/MarkOutControl.js +0 -155
- package/components/marking-controls/MarkingAddButton.js +0 -94
- package/components/marking-controls/MarkingControl.js +0 -135
- package/components/marking-controls/MarkingDeleteButton.js +0 -84
- package/components/marking-controls/MarkingDuration.js +0 -77
- package/components/marking-controls/MarkingPreview.js +0 -86
- package/components/progress-bar/AudioWaveform.js +0 -144
- package/components/progress-bar/LoadProgressBar.js +0 -90
- package/components/progress-bar/MouseTimeDisplay.js +0 -53
- package/components/progress-bar/PlayProgressBar.js +0 -79
- package/components/progress-bar/ProgressControl.js +0 -222
- package/components/progress-bar/SeekBar.js +0 -261
- package/components/progress-bar/Timeline.js +0 -134
- package/components/settings-menu-control/PlaybackRateControl.js +0 -147
- package/components/settings-menu-control/SafeAreaControl.js +0 -92
- package/components/settings-menu-control/SettingsMenu.js +0 -68
- package/components/settings-menu-control/SubtitleControl.js +0 -1
- package/components/time-controls/CurrentTimeDisplay.js +0 -53
- package/components/time-controls/DurationDisplay.js +0 -51
- package/components/time-controls/TimeDivider.js +0 -41
- package/components/volume-control/VolumeBar.js +0 -216
- package/components/volume-control/VolumeControl.js +0 -35
- package/components/volume-control/VolumeLevel.js +0 -78
- package/components/zoom-control/ZoomBar.js +0 -189
- package/components/zoom-control/ZoomLevel.js +0 -68
- package/reducers/index.js +0 -23
- package/reducers/operation.js +0 -36
- package/reducers/player.js +0 -222
- package/utils/browser.js +0 -29
- package/utils/fullscreen.js +0 -73
package/components/Video.js
DELETED
|
@@ -1,1431 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
-
|
|
9
|
-
var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
-
|
|
11
|
-
var _propTypes = require('prop-types');
|
|
12
|
-
|
|
13
|
-
var _react = require('react');
|
|
14
|
-
|
|
15
|
-
var _react2 = _interopRequireDefault(_react);
|
|
16
|
-
|
|
17
|
-
var _styledComponents = require('styled-components');
|
|
18
|
-
|
|
19
|
-
var _styledComponents2 = _interopRequireDefault(_styledComponents);
|
|
20
|
-
|
|
21
|
-
var _hls = require('hls.js');
|
|
22
|
-
|
|
23
|
-
var _hls2 = _interopRequireDefault(_hls);
|
|
24
|
-
|
|
25
|
-
var _Manager = require('../Manager');
|
|
26
|
-
|
|
27
|
-
var _Manager2 = _interopRequireDefault(_Manager);
|
|
28
|
-
|
|
29
|
-
var _utils = require('../utils');
|
|
30
|
-
|
|
31
|
-
var _BigPlayButton = require('./BigPlayButton');
|
|
32
|
-
|
|
33
|
-
var _BigPlayButton2 = _interopRequireDefault(_BigPlayButton);
|
|
34
|
-
|
|
35
|
-
var _PosterImage = require('./PosterImage');
|
|
36
|
-
|
|
37
|
-
var _PosterImage2 = _interopRequireDefault(_PosterImage);
|
|
38
|
-
|
|
39
|
-
var _SDOutline = require('./SDOutline');
|
|
40
|
-
|
|
41
|
-
var _SDOutline2 = _interopRequireDefault(_SDOutline);
|
|
42
|
-
|
|
43
|
-
var _components = require('@desynova-digital/components/components');
|
|
44
|
-
|
|
45
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
46
|
-
|
|
47
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
48
|
-
|
|
49
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
50
|
-
|
|
51
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
52
|
-
|
|
53
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
54
|
-
|
|
55
|
-
var propTypes = {
|
|
56
|
-
actions: _propTypes.PropTypes.instanceOf(Object),
|
|
57
|
-
player: _propTypes.PropTypes.instanceOf(Object),
|
|
58
|
-
startTime: _propTypes.PropTypes.number,
|
|
59
|
-
loop: _propTypes.PropTypes.bool,
|
|
60
|
-
muted: _propTypes.PropTypes.bool,
|
|
61
|
-
autoPlay: _propTypes.PropTypes.bool,
|
|
62
|
-
playsInline: _propTypes.PropTypes.bool,
|
|
63
|
-
src: _propTypes.PropTypes.string,
|
|
64
|
-
poster: _propTypes.PropTypes.string,
|
|
65
|
-
className: _propTypes.PropTypes.string,
|
|
66
|
-
fileType: _propTypes.PropTypes.oneOf(['video', 'image', 'audio']),
|
|
67
|
-
preload: _propTypes.PropTypes.oneOf(['auto', 'metadata', 'none']),
|
|
68
|
-
crossOrigin: _propTypes.PropTypes.string,
|
|
69
|
-
fluid: _propTypes.PropTypes.bool,
|
|
70
|
-
children: _propTypes.PropTypes.arrayOf(_propTypes.PropTypes.element),
|
|
71
|
-
store: _propTypes.PropTypes.instanceOf(Object),
|
|
72
|
-
width: _propTypes.PropTypes.number,
|
|
73
|
-
activeTrackIndex: _propTypes.PropTypes.number,
|
|
74
|
-
height: _propTypes.PropTypes.number,
|
|
75
|
-
videoId: _propTypes.PropTypes.string,
|
|
76
|
-
onLoadStart: _propTypes.PropTypes.func,
|
|
77
|
-
onWaiting: _propTypes.PropTypes.func,
|
|
78
|
-
onCanPlay: _propTypes.PropTypes.func,
|
|
79
|
-
onCanPlayThrough: _propTypes.PropTypes.func,
|
|
80
|
-
onPlaying: _propTypes.PropTypes.func,
|
|
81
|
-
onEnded: _propTypes.PropTypes.func,
|
|
82
|
-
onSeeking: _propTypes.PropTypes.func,
|
|
83
|
-
onSeeked: _propTypes.PropTypes.func,
|
|
84
|
-
onPlay: _propTypes.PropTypes.func,
|
|
85
|
-
onPause: _propTypes.PropTypes.func,
|
|
86
|
-
onProgress: _propTypes.PropTypes.func,
|
|
87
|
-
onDurationChange: _propTypes.PropTypes.func,
|
|
88
|
-
onError: _propTypes.PropTypes.func,
|
|
89
|
-
onSuspend: _propTypes.PropTypes.func,
|
|
90
|
-
onAbort: _propTypes.PropTypes.func,
|
|
91
|
-
onEmptied: _propTypes.PropTypes.func,
|
|
92
|
-
onStalled: _propTypes.PropTypes.func,
|
|
93
|
-
onLoadedMetadata: _propTypes.PropTypes.func,
|
|
94
|
-
onLoadedData: _propTypes.PropTypes.func,
|
|
95
|
-
onTimeUpdate: _propTypes.PropTypes.func,
|
|
96
|
-
onRateChange: _propTypes.PropTypes.func,
|
|
97
|
-
onVolumeChange: _propTypes.PropTypes.func,
|
|
98
|
-
onResize: _propTypes.PropTypes.func,
|
|
99
|
-
aspectRatio: _propTypes.PropTypes.string,
|
|
100
|
-
onPlayerClose: _propTypes.PropTypes.func,
|
|
101
|
-
userEmail: _propTypes.PropTypes.string,
|
|
102
|
-
playerSelectedMarker: _propTypes.PropTypes.instanceOf(Object)
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
var defaultProps = {
|
|
106
|
-
startTime: 0,
|
|
107
|
-
loop: false,
|
|
108
|
-
muted: false,
|
|
109
|
-
autoPlay: false,
|
|
110
|
-
playsInline: false,
|
|
111
|
-
preload: 'auto',
|
|
112
|
-
aspectRatio: 'auto',
|
|
113
|
-
crossOrigin: 'anonymous'
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
var SubTitleSection = _styledComponents2.default.div.withConfig({
|
|
117
|
-
displayName: 'Video__SubTitleSection',
|
|
118
|
-
componentId: 'sc-omlcc3-0'
|
|
119
|
-
})(['position:absolute;font-family:SFUIText-Regular;font-size:16px;bottom:20px;width:100%;display:flex;justify-content:center;text-align:center;color:#FFFFFF;height:90%;align-items:center;.subtitleContainer{border-radius:4px;width:fit-content;background:#000000;opacity:0.9;padding:8px 10px;line-height:20px;position:absolute;}']);
|
|
120
|
-
|
|
121
|
-
var VideoBlock = _styledComponents2.default.div.withConfig({
|
|
122
|
-
displayName: 'Video__VideoBlock',
|
|
123
|
-
componentId: 'sc-omlcc3-1'
|
|
124
|
-
})(['position:relative;&.video-react-player-block{position:relative;transition:all 0.1s ease-in-out;-moz-transition:all 0.1s ease-in-out;-webkit-transition:all 0.1s ease-in-out;-ms-transition:all 0.1s ease-in-out;-o-transition:all 0.1s ease-in-out;video{position:absolute;top:0;left:0;width:100%;height:100%;right:0;bottom:0;}.audio-tracks{position:relative;display:flex;background:rgba(0,0,0,0.5);color:#fff;z-index:10;position:absolute;width:100%;bottom:0;p{cursor:pointer;padding:10px;}}.loader-container{width:100%;height:100%;display:flex;justify-content:center;align-items:center;position:absolute;z-index:10;background:rgba(0,0,0,0.5)}}&.ratio-border{border:1px solid rgba(255,255,255,0.5);&:after{content:\'16:9 Safe Area\';position:absolute;color:#fff;font-family:SFUIText-Regular;font-size:12px;transform:rotate(-90deg);top:20%;left:-50px;}}']);
|
|
125
|
-
|
|
126
|
-
var Video = function (_Component) {
|
|
127
|
-
_inherits(Video, _Component);
|
|
128
|
-
|
|
129
|
-
function Video(props) {
|
|
130
|
-
_classCallCheck(this, Video);
|
|
131
|
-
|
|
132
|
-
var _this = _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).call(this, props));
|
|
133
|
-
|
|
134
|
-
_this.state = {
|
|
135
|
-
audioTracks: [],
|
|
136
|
-
isM3U8: false,
|
|
137
|
-
watermark: {
|
|
138
|
-
'color': 'rgb(255, 255, 255)',
|
|
139
|
-
'position': 'absolute',
|
|
140
|
-
'font-family': 'SFUIText-Regular',
|
|
141
|
-
'text-shadow': '0 0 4px rgb(0 0 0 / 50%)',
|
|
142
|
-
'font-size': '12px',
|
|
143
|
-
'opacity': '0.6',
|
|
144
|
-
'display': 'block',
|
|
145
|
-
'top': '0px',
|
|
146
|
-
'left': '0px'
|
|
147
|
-
},
|
|
148
|
-
watermarkInterval: -1,
|
|
149
|
-
isBuffering: false,
|
|
150
|
-
currentSubtitleObj: {}
|
|
151
|
-
};
|
|
152
|
-
_this.video = null; // the html5 video
|
|
153
|
-
_this.manager = new _Manager2.default(props.store);
|
|
154
|
-
_this.getStyle = _this.getStyle.bind(_this);
|
|
155
|
-
_this.getChildren = _this.getChildren.bind(_this);
|
|
156
|
-
_this.play = _this.play.bind(_this);
|
|
157
|
-
_this.pause = _this.pause.bind(_this);
|
|
158
|
-
_this.seek = _this.seek.bind(_this);
|
|
159
|
-
_this.forward = _this.forward.bind(_this);
|
|
160
|
-
_this.replay = _this.replay.bind(_this);
|
|
161
|
-
_this.toggleFullscreen = _this.toggleFullscreen.bind(_this);
|
|
162
|
-
_this.getProperties = _this.getProperties.bind(_this);
|
|
163
|
-
_this.renderChildren = _this.renderChildren.bind(_this);
|
|
164
|
-
_this.handleLoadStart = _this.handleLoadStart.bind(_this);
|
|
165
|
-
_this.handleCanPlay = _this.handleCanPlay.bind(_this);
|
|
166
|
-
_this.handleCanPlayThrough = _this.handleCanPlayThrough.bind(_this);
|
|
167
|
-
_this.handlePlay = _this.handlePlay.bind(_this);
|
|
168
|
-
_this.handlePlaying = _this.handlePlaying.bind(_this);
|
|
169
|
-
_this.handlePause = _this.handlePause.bind(_this);
|
|
170
|
-
_this.handleEnded = _this.handleEnded.bind(_this);
|
|
171
|
-
_this.handleWaiting = _this.handleWaiting.bind(_this);
|
|
172
|
-
_this.handleSeeking = _this.handleSeeking.bind(_this);
|
|
173
|
-
_this.handleSeeked = _this.handleSeeked.bind(_this);
|
|
174
|
-
_this.handleFullscreenChange = _this.handleFullscreenChange.bind(_this);
|
|
175
|
-
_this.handleError = _this.handleError.bind(_this);
|
|
176
|
-
_this.handleSuspend = _this.handleSuspend.bind(_this);
|
|
177
|
-
_this.handleAbort = _this.handleAbort.bind(_this);
|
|
178
|
-
_this.handleEmptied = _this.handleEmptied.bind(_this);
|
|
179
|
-
_this.handleStalled = _this.handleStalled.bind(_this);
|
|
180
|
-
_this.handleLoadedMetaData = _this.handleLoadedMetaData.bind(_this);
|
|
181
|
-
_this.handleLoadedData = _this.handleLoadedData.bind(_this);
|
|
182
|
-
_this.handleTimeUpdate = _this.handleTimeUpdate.bind(_this);
|
|
183
|
-
_this.handleRateChange = _this.handleRateChange.bind(_this);
|
|
184
|
-
_this.handleVolumeChange = _this.handleVolumeChange.bind(_this);
|
|
185
|
-
_this.handleDurationChange = _this.handleDurationChange.bind(_this);
|
|
186
|
-
_this.handleProgress = (0, _utils.throttle)(_this.handleProgress.bind(_this), 250);
|
|
187
|
-
_this.handleKeypress = _this.handleKeypress.bind(_this);
|
|
188
|
-
_this.audioVisualizer = _this.audioVisualizer.bind(_this);
|
|
189
|
-
_this.checkWatermark = _this.checkWatermark.bind(_this);
|
|
190
|
-
return _this;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
_createClass(Video, [{
|
|
194
|
-
key: 'componentDidMount',
|
|
195
|
-
value: function componentDidMount() {
|
|
196
|
-
var src = this.props.src;
|
|
197
|
-
|
|
198
|
-
var isM3U8 = src.split('.').pop() === 'm3u8' ? true : false;
|
|
199
|
-
this.setState({
|
|
200
|
-
isM3U8: isM3U8
|
|
201
|
-
});
|
|
202
|
-
if (_hls2.default.isSupported() && isM3U8) {
|
|
203
|
-
var _manager$getState = this.manager.getState(),
|
|
204
|
-
HLSConfig = _manager$getState.player.HLSConfig;
|
|
205
|
-
|
|
206
|
-
this.hls = new _hls2.default(HLSConfig);
|
|
207
|
-
this.setupHLS(src);
|
|
208
|
-
} else {
|
|
209
|
-
this.video.src = src;
|
|
210
|
-
}
|
|
211
|
-
this.forceUpdate(); // make sure the children can get the video property
|
|
212
|
-
var watermarkInterval = setInterval(this.checkWatermark, 20000);
|
|
213
|
-
this.setState({
|
|
214
|
-
watermarkInterval: watermarkInterval
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}, {
|
|
218
|
-
key: 'componentWillUnmount',
|
|
219
|
-
value: function componentWillUnmount() {
|
|
220
|
-
var _state = this.state,
|
|
221
|
-
isM3U8 = _state.isM3U8,
|
|
222
|
-
watermarkInterval = _state.watermarkInterval;
|
|
223
|
-
|
|
224
|
-
if (_hls2.default.isSupported() && isM3U8) {
|
|
225
|
-
this.hls.detachMedia();
|
|
226
|
-
} else {
|
|
227
|
-
this.video.src = '';
|
|
228
|
-
}
|
|
229
|
-
clearInterval(watermarkInterval);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* This function is triggered on interval to shuffle the position of watermark on Player area
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
}, {
|
|
237
|
-
key: 'checkWatermark',
|
|
238
|
-
value: function checkWatermark() {
|
|
239
|
-
var watermark = this.state.watermark;
|
|
240
|
-
var _props = this.props,
|
|
241
|
-
onPlayerClose = _props.onPlayerClose,
|
|
242
|
-
userEmail = _props.userEmail;
|
|
243
|
-
|
|
244
|
-
var watermark_text = document.querySelector('#watermark-text');
|
|
245
|
-
var video_player = null;
|
|
246
|
-
var watermark_dimension = null;
|
|
247
|
-
var text_css = null;
|
|
248
|
-
var bool_text = false;
|
|
249
|
-
|
|
250
|
-
if (!watermark_text) {
|
|
251
|
-
onPlayerClose();
|
|
252
|
-
} else {
|
|
253
|
-
video_player = document.querySelector('.video-react-player-block').getBoundingClientRect();
|
|
254
|
-
watermark_dimension = watermark_text.getBoundingClientRect();
|
|
255
|
-
text_css = watermark_text.style;
|
|
256
|
-
bool_text = text_css.position !== 'absolute' || text_css.opacity !== '0.6' || text_css['font-family'] !== 'SFUIText-Regular' && text_css['font-family'] !== '"SFUIText-Regular"';
|
|
257
|
-
bool_text = bool_text || text_css.display !== 'block';
|
|
258
|
-
bool_text = bool_text || text_css.top !== watermark.top;
|
|
259
|
-
bool_text = bool_text || text_css.left !== watermark.left;
|
|
260
|
-
bool_text = bool_text || text_css.length !== 9 || text_css['font-size'] !== '12px';
|
|
261
|
-
bool_text = bool_text || text_css.color !== 'rgb(255, 255, 255)';
|
|
262
|
-
bool_text = bool_text || userEmail !== watermark_text.innerText;
|
|
263
|
-
if (bool_text) {
|
|
264
|
-
onPlayerClose();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
watermark.left = (Math.random() * (video_player.width - watermark_dimension.width)).toFixed(0) + "px";
|
|
268
|
-
watermark.top = (Math.random() * (video_player.height - watermark_dimension.height)).toFixed(0) + "px";
|
|
269
|
-
this.setState({
|
|
270
|
-
watermark: watermark
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: 'setupHLS',
|
|
275
|
-
value: function setupHLS(src) {
|
|
276
|
-
var _this2 = this;
|
|
277
|
-
|
|
278
|
-
var _props2 = this.props,
|
|
279
|
-
actions = _props2.actions,
|
|
280
|
-
activeTrackIndex = _props2.activeTrackIndex;
|
|
281
|
-
|
|
282
|
-
var self = this;
|
|
283
|
-
// bind them together
|
|
284
|
-
this.hls.attachMedia(this.video);
|
|
285
|
-
this.hls.on(_hls2.default.Events.MEDIA_ATTACHED, function () {
|
|
286
|
-
self.hls.loadSource(src);
|
|
287
|
-
});
|
|
288
|
-
this.hls.on(_hls2.default.Events.MANIFEST_PARSED, function (event, data) {
|
|
289
|
-
var trackIndex = activeTrackIndex || 0;
|
|
290
|
-
actions.handleAudioTracks(data.audioTracks);
|
|
291
|
-
actions.handleAudioTrackChange(data.audioTracks[trackIndex]);
|
|
292
|
-
});
|
|
293
|
-
this.hls.on(_hls2.default.Events.ERROR, function (event, data) {
|
|
294
|
-
// eslint-disable-next-line no-console
|
|
295
|
-
console.log('HLS.Events.ERROR: ', event, data);
|
|
296
|
-
if (data.fatal) {
|
|
297
|
-
switch (data.type) {
|
|
298
|
-
case _hls2.default.ErrorTypes.NETWORK_ERROR:
|
|
299
|
-
// try to recover network error
|
|
300
|
-
_this2.hls.startLoad();
|
|
301
|
-
break;
|
|
302
|
-
case _hls2.default.ErrorTypes.MEDIA_ERROR:
|
|
303
|
-
_this2.hls.recoverMediaError();
|
|
304
|
-
break;
|
|
305
|
-
default:
|
|
306
|
-
// cannot recover
|
|
307
|
-
_this2.hls.destroy();
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
} else if (data.details === 'internalException' && data.type === 'otherError') {
|
|
311
|
-
_this2.hls.startLoad();
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}, {
|
|
316
|
-
key: 'getDefaultChildren',
|
|
317
|
-
value: function getDefaultChildren(props) {
|
|
318
|
-
return [_react2.default.createElement(_PosterImage2.default, _extends({ key: 'poster-image', order: 1.0 }, props)), _react2.default.createElement(_SDOutline2.default, _extends({ key: 'sd-outline', order: 2.0 }, props)), _react2.default.createElement(_BigPlayButton2.default, _extends({ key: 'big-play-button', order: 5.0 }, props))];
|
|
319
|
-
}
|
|
320
|
-
}, {
|
|
321
|
-
key: 'getChildren',
|
|
322
|
-
value: function getChildren(props) {
|
|
323
|
-
var propsWithoutChildren = _extends({}, props, {
|
|
324
|
-
children: null
|
|
325
|
-
});
|
|
326
|
-
var children = this.props.children;
|
|
327
|
-
|
|
328
|
-
var childs = _react2.default.Children.toArray(children).filter(function (e) {
|
|
329
|
-
return !(0, _utils.isVideoChild)(e);
|
|
330
|
-
});
|
|
331
|
-
var defaultChildren = this.getDefaultChildren(propsWithoutChildren, props);
|
|
332
|
-
return (0, _utils.mergeAndSortChildren)(defaultChildren, childs, propsWithoutChildren);
|
|
333
|
-
}
|
|
334
|
-
}, {
|
|
335
|
-
key: 'setWidthOrHeight',
|
|
336
|
-
value: function setWidthOrHeight(style, name, value) {
|
|
337
|
-
var styleVal = void 0;
|
|
338
|
-
if (typeof value === 'string') {
|
|
339
|
-
if (value === 'auto') {
|
|
340
|
-
styleVal = 'auto';
|
|
341
|
-
} else if (value.match(/\d+%/)) {
|
|
342
|
-
styleVal = value;
|
|
343
|
-
}
|
|
344
|
-
} else if (typeof value === 'number') {
|
|
345
|
-
styleVal = value + 'px';
|
|
346
|
-
}
|
|
347
|
-
Object.assign(style, _defineProperty({}, name, styleVal));
|
|
348
|
-
}
|
|
349
|
-
}, {
|
|
350
|
-
key: 'getStyle',
|
|
351
|
-
value: function getStyle() {
|
|
352
|
-
var fluid = this.props.fluid;
|
|
353
|
-
|
|
354
|
-
var _manager$getState2 = this.manager.getState(),
|
|
355
|
-
player = _manager$getState2.player;
|
|
356
|
-
|
|
357
|
-
var style = {};
|
|
358
|
-
var _props3 = this.props,
|
|
359
|
-
aspectRatio = _props3.aspectRatio,
|
|
360
|
-
width = _props3.width,
|
|
361
|
-
height = _props3.height;
|
|
362
|
-
/*
|
|
363
|
-
* The aspect ratio is either used directly
|
|
364
|
-
* or to calculate width and height.
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
if (player.videoWidth) {
|
|
368
|
-
// Otherwise try to get the aspect ratio from the video metadata
|
|
369
|
-
aspectRatio = '16:9';
|
|
370
|
-
// aspectRatio = `${player.videoWidth}:${player.videoHeight}`;
|
|
371
|
-
} else {
|
|
372
|
-
// Or use a default. The video element's is 2:1, but 16:9 is more common.
|
|
373
|
-
aspectRatio = '16:9';
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// Get the ratio as a decimal we can use to calculate dimensions
|
|
377
|
-
var ratioParts = aspectRatio.split(':');
|
|
378
|
-
var ratioMultiplier = ratioParts[1] / ratioParts[0];
|
|
379
|
-
|
|
380
|
-
if (height !== undefined) {
|
|
381
|
-
// Or calulate the width from the aspect ratio if a height has been set
|
|
382
|
-
width = height / ratioMultiplier;
|
|
383
|
-
} else {
|
|
384
|
-
// Or use the video's metadata, or use the video el's default of 300
|
|
385
|
-
width = player.videoWidth || 400;
|
|
386
|
-
height = width * ratioMultiplier;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (fluid) {
|
|
390
|
-
style.paddingTop = ratioMultiplier * 100 + '%';
|
|
391
|
-
} else {
|
|
392
|
-
// If Width contains 'auto', set 'auto' in style
|
|
393
|
-
this.setWidthOrHeight(style, 'width', width);
|
|
394
|
-
this.setWidthOrHeight(style, 'height', height);
|
|
395
|
-
}
|
|
396
|
-
style.width = '100%';
|
|
397
|
-
return style;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// get all video properties
|
|
401
|
-
|
|
402
|
-
}, {
|
|
403
|
-
key: 'getProperties',
|
|
404
|
-
value: function getProperties() {
|
|
405
|
-
var _this3 = this;
|
|
406
|
-
|
|
407
|
-
if (!this.video) {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return _utils.mediaProperties.reduce(function (properties, key) {
|
|
412
|
-
properties[key] = _this3.video[key];
|
|
413
|
-
return properties;
|
|
414
|
-
}, {});
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// get playback rate
|
|
418
|
-
|
|
419
|
-
}, {
|
|
420
|
-
key: 'UNSAFE_componentWillReceiveProps',
|
|
421
|
-
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
422
|
-
var _props4 = this.props,
|
|
423
|
-
src = _props4.src,
|
|
424
|
-
activeAudio = _props4.player.activeAudio,
|
|
425
|
-
currentSubtitleObj = _props4.currentSubtitleObj,
|
|
426
|
-
markers = _props4.markers;
|
|
427
|
-
|
|
428
|
-
if (newProps.src !== src) {
|
|
429
|
-
var isM3U8 = this.state.isM3U8;
|
|
430
|
-
|
|
431
|
-
if (_hls2.default.isSupported() && isM3U8) {
|
|
432
|
-
this.hls.detachMedia();
|
|
433
|
-
} else {
|
|
434
|
-
this.video.src = '';
|
|
435
|
-
}
|
|
436
|
-
var m3u8 = newProps.src.split('.').pop() === 'm3u8' ? true : false;
|
|
437
|
-
this.setState({
|
|
438
|
-
isM3U8: m3u8
|
|
439
|
-
});
|
|
440
|
-
if (_hls2.default.isSupported() && m3u8) {
|
|
441
|
-
var _manager$getState3 = this.manager.getState(),
|
|
442
|
-
HLSConfig = _manager$getState3.player.HLSConfig;
|
|
443
|
-
|
|
444
|
-
this.hls = new _hls2.default(HLSConfig);
|
|
445
|
-
this.setupHLS(newProps.src);
|
|
446
|
-
} else {
|
|
447
|
-
this.video.src = newProps.src;
|
|
448
|
-
}
|
|
449
|
-
this.forceUpdate(); // make sure the children can get the video property
|
|
450
|
-
}
|
|
451
|
-
if (newProps.player.activeAudio && activeAudio && activeAudio.id !== newProps.player.activeAudio.id) {
|
|
452
|
-
this.hls.audioTrack = newProps.player.activeAudio.id;
|
|
453
|
-
}
|
|
454
|
-
if (newProps.subtitleObj && newProps.subtitleObj.field && JSON.stringify(newProps.subtitleObj) !== JSON.stringify(currentSubtitleObj)) {
|
|
455
|
-
if (newProps.subtitleObj && newProps.subtitleObj.field && !newProps.subtitleObj.field.line1) {
|
|
456
|
-
this.setState({
|
|
457
|
-
currentSubtitleObj: {}
|
|
458
|
-
});
|
|
459
|
-
} else if (newProps.subtitleObj && newProps.subtitleObj.field && newProps.subtitleObj.field.line1) {
|
|
460
|
-
var style = this.getSubtitleStyle(newProps.subtitleObj.field);
|
|
461
|
-
this.setState({
|
|
462
|
-
currentSubtitleObj: {
|
|
463
|
-
line1: newProps.subtitleObj.field.line1,
|
|
464
|
-
line2: newProps.subtitleObj.field.line2,
|
|
465
|
-
start_time: newProps.subtitleObj.field.in_time,
|
|
466
|
-
end_time: newProps.subtitleObj.field.out_time,
|
|
467
|
-
style: style
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (newProps.markers.length && markers.length && newProps.markers[0].values.length !== markers[0].values.length) {
|
|
473
|
-
this.displaySubtitle(newProps.markers);
|
|
474
|
-
}
|
|
475
|
-
if (newProps.subtitleReadOnly && newProps.subtitleDataList) {
|
|
476
|
-
this.displaySubtitle(newProps.subtitleDataList);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// play the video
|
|
481
|
-
|
|
482
|
-
}, {
|
|
483
|
-
key: 'play',
|
|
484
|
-
value: function play() {
|
|
485
|
-
var promise = this.video.play();
|
|
486
|
-
if (promise !== undefined) {
|
|
487
|
-
promise.catch(function () {}).then(function () {});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// pause the video
|
|
492
|
-
|
|
493
|
-
}, {
|
|
494
|
-
key: 'pause',
|
|
495
|
-
value: function pause() {
|
|
496
|
-
var promise = this.video.pause();
|
|
497
|
-
if (promise !== undefined) {
|
|
498
|
-
promise.catch(function () {}).then(function () {});
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// Change the video source and re-load the video:
|
|
503
|
-
|
|
504
|
-
}, {
|
|
505
|
-
key: 'load',
|
|
506
|
-
value: function load() {
|
|
507
|
-
this.video.load();
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// Add a new text track to the video
|
|
511
|
-
|
|
512
|
-
}, {
|
|
513
|
-
key: 'addTextTrack',
|
|
514
|
-
value: function addTextTrack() {
|
|
515
|
-
var _video;
|
|
516
|
-
|
|
517
|
-
(_video = this.video).addTextTrack.apply(_video, arguments);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Check if your browser can play different types of video:
|
|
521
|
-
|
|
522
|
-
}, {
|
|
523
|
-
key: 'canPlayType',
|
|
524
|
-
value: function canPlayType() {
|
|
525
|
-
var _video2;
|
|
526
|
-
|
|
527
|
-
(_video2 = this.video).canPlayType.apply(_video2, arguments);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// toggle play
|
|
531
|
-
|
|
532
|
-
}, {
|
|
533
|
-
key: 'togglePlay',
|
|
534
|
-
value: function togglePlay() {
|
|
535
|
-
if (this.video.paused) {
|
|
536
|
-
this.play();
|
|
537
|
-
} else {
|
|
538
|
-
this.pause();
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
// seek video by time
|
|
543
|
-
|
|
544
|
-
}, {
|
|
545
|
-
key: 'seek',
|
|
546
|
-
value: function seek(time) {
|
|
547
|
-
try {
|
|
548
|
-
this.video.currentTime = time;
|
|
549
|
-
} catch (e) {
|
|
550
|
-
// console.log(e, 'Video is not ready.')
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// jump forward x seconds
|
|
555
|
-
|
|
556
|
-
}, {
|
|
557
|
-
key: 'forward',
|
|
558
|
-
value: function forward(seconds) {
|
|
559
|
-
this.seek(this.video.currentTime + seconds);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// jump back x seconds
|
|
563
|
-
|
|
564
|
-
}, {
|
|
565
|
-
key: 'replay',
|
|
566
|
-
value: function replay(seconds) {
|
|
567
|
-
this.forward(-seconds);
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// enter or exist full screen
|
|
571
|
-
|
|
572
|
-
}, {
|
|
573
|
-
key: 'toggleFullscreen',
|
|
574
|
-
value: function toggleFullscreen() {
|
|
575
|
-
var _props5 = this.props,
|
|
576
|
-
player = _props5.player,
|
|
577
|
-
actions = _props5.actions;
|
|
578
|
-
|
|
579
|
-
actions.toggleFullscreen(player);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
/*
|
|
583
|
-
* Fired when the user agent
|
|
584
|
-
* begins looking for media data
|
|
585
|
-
*/
|
|
586
|
-
|
|
587
|
-
}, {
|
|
588
|
-
key: 'handleLoadStart',
|
|
589
|
-
value: function handleLoadStart() {
|
|
590
|
-
var _props6 = this.props,
|
|
591
|
-
actions = _props6.actions,
|
|
592
|
-
onLoadStart = _props6.onLoadStart,
|
|
593
|
-
fileType = _props6.fileType;
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
if (fileType === 'audio') {
|
|
597
|
-
this.audioVisualizer();
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
actions.handleLoadStart(this.getProperties());
|
|
601
|
-
if (onLoadStart) {
|
|
602
|
-
onLoadStart.apply(undefined, arguments);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
/*
|
|
607
|
-
* A handler for events that
|
|
608
|
-
* signal that waiting has ended
|
|
609
|
-
*/
|
|
610
|
-
|
|
611
|
-
}, {
|
|
612
|
-
key: 'handleCanPlay',
|
|
613
|
-
value: function handleCanPlay() {
|
|
614
|
-
var _props7 = this.props,
|
|
615
|
-
actions = _props7.actions,
|
|
616
|
-
onCanPlay = _props7.onCanPlay;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
actions.handleCanPlay(this.getProperties());
|
|
620
|
-
|
|
621
|
-
if (onCanPlay) {
|
|
622
|
-
onCanPlay.apply(undefined, arguments);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/*
|
|
627
|
-
* A handler for events that
|
|
628
|
-
* signal that waiting has ended
|
|
629
|
-
*/
|
|
630
|
-
|
|
631
|
-
}, {
|
|
632
|
-
key: 'handleCanPlayThrough',
|
|
633
|
-
value: function handleCanPlayThrough() {
|
|
634
|
-
var _props8 = this.props,
|
|
635
|
-
actions = _props8.actions,
|
|
636
|
-
onCanPlayThrough = _props8.onCanPlayThrough;
|
|
637
|
-
|
|
638
|
-
actions.handleCanPlayThrough(this.getProperties());
|
|
639
|
-
|
|
640
|
-
if (onCanPlayThrough) {
|
|
641
|
-
onCanPlayThrough.apply(undefined, arguments);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/*
|
|
646
|
-
* A handler for events that
|
|
647
|
-
* signal that waiting has ended
|
|
648
|
-
*/
|
|
649
|
-
|
|
650
|
-
}, {
|
|
651
|
-
key: 'handlePlaying',
|
|
652
|
-
value: function handlePlaying() {
|
|
653
|
-
var _props9 = this.props,
|
|
654
|
-
actions = _props9.actions,
|
|
655
|
-
onPlaying = _props9.onPlaying;
|
|
656
|
-
|
|
657
|
-
actions.handlePlaying(this.getProperties());
|
|
658
|
-
|
|
659
|
-
if (onPlaying) {
|
|
660
|
-
onPlaying.apply(undefined, arguments);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// Fired whenever the media has been started
|
|
665
|
-
|
|
666
|
-
}, {
|
|
667
|
-
key: 'handlePlay',
|
|
668
|
-
value: function handlePlay() {
|
|
669
|
-
var _props10 = this.props,
|
|
670
|
-
actions = _props10.actions,
|
|
671
|
-
onPlay = _props10.onPlay;
|
|
672
|
-
|
|
673
|
-
actions.handlePlay(this.getProperties());
|
|
674
|
-
|
|
675
|
-
if (onPlay) {
|
|
676
|
-
onPlay.apply(undefined, arguments);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// Fired whenever the media has been paused
|
|
681
|
-
|
|
682
|
-
}, {
|
|
683
|
-
key: 'handlePause',
|
|
684
|
-
value: function handlePause() {
|
|
685
|
-
var _props11 = this.props,
|
|
686
|
-
actions = _props11.actions,
|
|
687
|
-
onPause = _props11.onPause;
|
|
688
|
-
|
|
689
|
-
actions.handlePause(this.getProperties());
|
|
690
|
-
|
|
691
|
-
if (onPause) {
|
|
692
|
-
onPause.apply(undefined, arguments);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
/*
|
|
697
|
-
* Fired when the duration of
|
|
698
|
-
* the media resource is first known or changed
|
|
699
|
-
*/
|
|
700
|
-
|
|
701
|
-
}, {
|
|
702
|
-
key: 'handleDurationChange',
|
|
703
|
-
value: function handleDurationChange() {
|
|
704
|
-
var _props12 = this.props,
|
|
705
|
-
actions = _props12.actions,
|
|
706
|
-
onDurationChange = _props12.onDurationChange;
|
|
707
|
-
|
|
708
|
-
actions.handleDurationChange(this.getProperties());
|
|
709
|
-
|
|
710
|
-
if (onDurationChange) {
|
|
711
|
-
onDurationChange.apply(undefined, arguments);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/*
|
|
716
|
-
* Fired while the user agent
|
|
717
|
-
* is downloading media data
|
|
718
|
-
*/
|
|
719
|
-
|
|
720
|
-
}, {
|
|
721
|
-
key: 'handleProgress',
|
|
722
|
-
value: function handleProgress() {
|
|
723
|
-
var _props13 = this.props,
|
|
724
|
-
actions = _props13.actions,
|
|
725
|
-
onProgress = _props13.onProgress;
|
|
726
|
-
|
|
727
|
-
if (this.video) {
|
|
728
|
-
actions.handleProgressChange(this.getProperties());
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
if (onProgress) {
|
|
732
|
-
onProgress.apply(undefined, arguments);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
}, {
|
|
736
|
-
key: 'getSubtitleStyle',
|
|
737
|
-
value: function getSubtitleStyle(data) {
|
|
738
|
-
var style = {};
|
|
739
|
-
style.top = data && data.text_position === 'text_position_top' ? '0px' : '';
|
|
740
|
-
style.bottom = data && data.text_position === 'text_position_bottom' ? '0px' : '';
|
|
741
|
-
style.left = data && data.text_alignment === 'text_aligned_left' ? '0px' : '';
|
|
742
|
-
style.right = data && data.text_alignment === 'text_aligned_right' ? '0px' : '';
|
|
743
|
-
return style;
|
|
744
|
-
}
|
|
745
|
-
}, {
|
|
746
|
-
key: 'displaySubtitle',
|
|
747
|
-
value: function displaySubtitle(marker) {
|
|
748
|
-
var _props14 = this.props,
|
|
749
|
-
markers = _props14.markers,
|
|
750
|
-
resetSubtitleData = _props14.resetSubtitleData,
|
|
751
|
-
subtitleReadOnly = _props14.subtitleReadOnly,
|
|
752
|
-
subtitleDataList = _props14.subtitleDataList;
|
|
753
|
-
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
754
|
-
|
|
755
|
-
if (resetSubtitleData) {
|
|
756
|
-
resetSubtitleData();
|
|
757
|
-
}
|
|
758
|
-
var currentTime = this.video.currentTime;
|
|
759
|
-
var currentMarker = marker || markers;
|
|
760
|
-
if (subtitleReadOnly) {
|
|
761
|
-
currentMarker = marker || subtitleDataList;
|
|
762
|
-
}
|
|
763
|
-
if (currentMarker && currentMarker[0] && currentMarker[0].name === "Subtitle") {
|
|
764
|
-
var values = currentMarker[0].values;
|
|
765
|
-
var currentValue = values.filter(function (ele) {
|
|
766
|
-
return ele.start_time <= currentTime && ele.end_time >= currentTime;
|
|
767
|
-
});
|
|
768
|
-
var style = this.getSubtitleStyle(currentValue[0]);
|
|
769
|
-
var currentLine1 = currentSubtitleObj && currentSubtitleObj.line1 || '';
|
|
770
|
-
var propsLine1 = currentValue[0] && currentValue[0].line1 || '';
|
|
771
|
-
if (currentValue && currentValue.length && (currentSubtitleObj.start_time === currentValue[0].start_time || currentSubtitleObj.end_time === currentValue[0].end_time) && currentLine1 === propsLine1 || Object.keys(currentSubtitleObj).length && currentValue.length && currentValue.length === currentSubtitleObj.start_time.length && currentValue.length === currentSubtitleObj.end_time.length && currentLine1 === propsLine1) {
|
|
772
|
-
return;
|
|
773
|
-
} else {
|
|
774
|
-
this.setState({
|
|
775
|
-
currentSubtitleObj: {
|
|
776
|
-
line1: currentValue[0] && currentValue[0].line1 || '',
|
|
777
|
-
line2: currentValue[0] && currentValue[0].line2 || '',
|
|
778
|
-
start_time: currentValue[0] && currentValue[0].start_time || 0,
|
|
779
|
-
end_time: currentValue[0] && currentValue[0].end_time || 0,
|
|
780
|
-
style: style
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/*
|
|
788
|
-
* Fired when the end of the media resource
|
|
789
|
-
* is reached (currentTime == duration)
|
|
790
|
-
*/
|
|
791
|
-
|
|
792
|
-
}, {
|
|
793
|
-
key: 'handleEnded',
|
|
794
|
-
value: function handleEnded() {
|
|
795
|
-
var _props15 = this.props,
|
|
796
|
-
loop = _props15.loop,
|
|
797
|
-
player = _props15.player,
|
|
798
|
-
actions = _props15.actions,
|
|
799
|
-
onEnded = _props15.onEnded;
|
|
800
|
-
|
|
801
|
-
if (loop) {
|
|
802
|
-
this.seek(0);
|
|
803
|
-
this.play();
|
|
804
|
-
} else if (!player.paused) {
|
|
805
|
-
this.pause();
|
|
806
|
-
}
|
|
807
|
-
actions.handleEnd(this.getProperties());
|
|
808
|
-
|
|
809
|
-
if (onEnded) {
|
|
810
|
-
onEnded.apply(undefined, arguments);
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// Fired whenever the media begins waiting
|
|
815
|
-
|
|
816
|
-
}, {
|
|
817
|
-
key: 'handleWaiting',
|
|
818
|
-
value: function handleWaiting() {
|
|
819
|
-
var _props16 = this.props,
|
|
820
|
-
actions = _props16.actions,
|
|
821
|
-
onWaiting = _props16.onWaiting;
|
|
822
|
-
|
|
823
|
-
actions.handleWaiting(this.getProperties());
|
|
824
|
-
|
|
825
|
-
if (onWaiting) {
|
|
826
|
-
onWaiting.apply(undefined, arguments);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
/*
|
|
831
|
-
* Fired whenever the player
|
|
832
|
-
* is jumping to a new time
|
|
833
|
-
*/
|
|
834
|
-
|
|
835
|
-
}, {
|
|
836
|
-
key: 'handleSeeking',
|
|
837
|
-
value: function handleSeeking() {
|
|
838
|
-
var _props17 = this.props,
|
|
839
|
-
actions = _props17.actions,
|
|
840
|
-
onSeeking = _props17.onSeeking;
|
|
841
|
-
|
|
842
|
-
actions.handleSeeking(this.getProperties());
|
|
843
|
-
|
|
844
|
-
if (onSeeking) {
|
|
845
|
-
onSeeking.apply(undefined, arguments);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
/*
|
|
850
|
-
* Fired when the player has
|
|
851
|
-
* finished jumping to a new time
|
|
852
|
-
*/
|
|
853
|
-
|
|
854
|
-
}, {
|
|
855
|
-
key: 'handleSeeked',
|
|
856
|
-
value: function handleSeeked() {
|
|
857
|
-
var _props18 = this.props,
|
|
858
|
-
actions = _props18.actions,
|
|
859
|
-
onSeeked = _props18.onSeeked;
|
|
860
|
-
|
|
861
|
-
actions.handleSeeked(this.getProperties());
|
|
862
|
-
|
|
863
|
-
if (onSeeked) {
|
|
864
|
-
onSeeked.apply(undefined, arguments);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
// Handle Fullscreen Change
|
|
869
|
-
|
|
870
|
-
}, {
|
|
871
|
-
key: 'handleFullscreenChange',
|
|
872
|
-
value: function handleFullscreenChange() {}
|
|
873
|
-
|
|
874
|
-
/*
|
|
875
|
-
* Fires when the browser is
|
|
876
|
-
* intentionally not getting media data
|
|
877
|
-
*/
|
|
878
|
-
|
|
879
|
-
}, {
|
|
880
|
-
key: 'handleSuspend',
|
|
881
|
-
value: function handleSuspend() {
|
|
882
|
-
var _props19 = this.props,
|
|
883
|
-
actions = _props19.actions,
|
|
884
|
-
onSuspend = _props19.onSuspend;
|
|
885
|
-
|
|
886
|
-
actions.handleSuspend(this.getProperties());
|
|
887
|
-
if (onSuspend) {
|
|
888
|
-
onSuspend.apply(undefined, arguments);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
// Fires when the loading of an audio/video is aborted
|
|
893
|
-
|
|
894
|
-
}, {
|
|
895
|
-
key: 'handleAbort',
|
|
896
|
-
value: function handleAbort() {
|
|
897
|
-
var _props20 = this.props,
|
|
898
|
-
actions = _props20.actions,
|
|
899
|
-
onAbort = _props20.onAbort;
|
|
900
|
-
|
|
901
|
-
actions.handleAbort(this.getProperties());
|
|
902
|
-
if (onAbort) {
|
|
903
|
-
onAbort.apply(undefined, arguments);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
// Fires when the current playlist is empty
|
|
908
|
-
|
|
909
|
-
}, {
|
|
910
|
-
key: 'handleEmptied',
|
|
911
|
-
value: function handleEmptied() {
|
|
912
|
-
var _props21 = this.props,
|
|
913
|
-
actions = _props21.actions,
|
|
914
|
-
onEmptied = _props21.onEmptied;
|
|
915
|
-
|
|
916
|
-
actions.handleEmptied(this.getProperties());
|
|
917
|
-
if (onEmptied) {
|
|
918
|
-
onEmptied.apply(undefined, arguments);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/*
|
|
923
|
-
* Fires when the browser is trying to
|
|
924
|
-
* get media data, but data is not available
|
|
925
|
-
*/
|
|
926
|
-
|
|
927
|
-
}, {
|
|
928
|
-
key: 'handleStalled',
|
|
929
|
-
value: function handleStalled() {
|
|
930
|
-
var _props22 = this.props,
|
|
931
|
-
actions = _props22.actions,
|
|
932
|
-
onStalled = _props22.onStalled;
|
|
933
|
-
|
|
934
|
-
actions.handleStalled(this.getProperties());
|
|
935
|
-
|
|
936
|
-
if (onStalled) {
|
|
937
|
-
onStalled.apply(undefined, arguments);
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
/*
|
|
942
|
-
* Fires when the browser has loaded
|
|
943
|
-
* meta data for the audio/video
|
|
944
|
-
*/
|
|
945
|
-
|
|
946
|
-
}, {
|
|
947
|
-
key: 'handleLoadedMetaData',
|
|
948
|
-
value: function handleLoadedMetaData() {
|
|
949
|
-
var _props23 = this.props,
|
|
950
|
-
actions = _props23.actions,
|
|
951
|
-
onLoadedMetadata = _props23.onLoadedMetadata,
|
|
952
|
-
startTime = _props23.startTime;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (startTime && startTime > 0) {
|
|
956
|
-
this.video.currentTime = startTime;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
actions.handleLoadedMetaData(this.getProperties());
|
|
960
|
-
|
|
961
|
-
if (onLoadedMetadata) {
|
|
962
|
-
onLoadedMetadata.apply(undefined, arguments);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
/*
|
|
967
|
-
* Fires when the browser has loaded
|
|
968
|
-
* the current frame of the audio/video
|
|
969
|
-
*/
|
|
970
|
-
|
|
971
|
-
}, {
|
|
972
|
-
key: 'handleLoadedData',
|
|
973
|
-
value: function handleLoadedData() {
|
|
974
|
-
var _props24 = this.props,
|
|
975
|
-
actions = _props24.actions,
|
|
976
|
-
onLoadedData = _props24.onLoadedData;
|
|
977
|
-
|
|
978
|
-
actions.handleLoadedData(this.getProperties());
|
|
979
|
-
|
|
980
|
-
if (onLoadedData) {
|
|
981
|
-
onLoadedData.apply(undefined, arguments);
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
/*
|
|
986
|
-
* Fires when the current
|
|
987
|
-
* playback position has changed
|
|
988
|
-
*/
|
|
989
|
-
|
|
990
|
-
}, {
|
|
991
|
-
key: 'handleTimeUpdate',
|
|
992
|
-
value: function handleTimeUpdate() {
|
|
993
|
-
var _props25 = this.props,
|
|
994
|
-
previewActive = _props25.player.previewActive,
|
|
995
|
-
actions = _props25.actions,
|
|
996
|
-
onTimeUpdate = _props25.onTimeUpdate,
|
|
997
|
-
rightMarker = _props25.playerSelectedMarker.rightMarker;
|
|
998
|
-
|
|
999
|
-
actions.handleTimeUpdate(this.getProperties());
|
|
1000
|
-
if (previewActive && this.video.currentTime >= rightMarker) {
|
|
1001
|
-
this.video.pause();
|
|
1002
|
-
actions.seek(rightMarker);
|
|
1003
|
-
actions.handleVideoPreview(false);
|
|
1004
|
-
}
|
|
1005
|
-
if (onTimeUpdate) {
|
|
1006
|
-
onTimeUpdate.apply(undefined, arguments);
|
|
1007
|
-
}
|
|
1008
|
-
this.displaySubtitle();
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* Fires when the playing speed of the audio/video is changed
|
|
1013
|
-
*/
|
|
1014
|
-
|
|
1015
|
-
}, {
|
|
1016
|
-
key: 'handleRateChange',
|
|
1017
|
-
value: function handleRateChange() {
|
|
1018
|
-
var _props26 = this.props,
|
|
1019
|
-
actions = _props26.actions,
|
|
1020
|
-
onRateChange = _props26.onRateChange;
|
|
1021
|
-
|
|
1022
|
-
actions.handleRateChange(this.getProperties());
|
|
1023
|
-
|
|
1024
|
-
if (onRateChange) {
|
|
1025
|
-
onRateChange.apply(undefined, arguments);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
// Fires when the volume has been changed
|
|
1030
|
-
|
|
1031
|
-
}, {
|
|
1032
|
-
key: 'handleVolumeChange',
|
|
1033
|
-
value: function handleVolumeChange() {
|
|
1034
|
-
var _props27 = this.props,
|
|
1035
|
-
actions = _props27.actions,
|
|
1036
|
-
onVolumeChange = _props27.onVolumeChange;
|
|
1037
|
-
|
|
1038
|
-
actions.handleVolumeChange(this.getProperties());
|
|
1039
|
-
|
|
1040
|
-
if (onVolumeChange) {
|
|
1041
|
-
onVolumeChange.apply(undefined, arguments);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
/*
|
|
1046
|
-
* Fires when an error occurred
|
|
1047
|
-
* during the loading of an audio/video
|
|
1048
|
-
*/
|
|
1049
|
-
|
|
1050
|
-
}, {
|
|
1051
|
-
key: 'handleError',
|
|
1052
|
-
value: function handleError() {
|
|
1053
|
-
var _props28 = this.props,
|
|
1054
|
-
actions = _props28.actions,
|
|
1055
|
-
onError = _props28.onError;
|
|
1056
|
-
|
|
1057
|
-
actions.handleError(this.getProperties());
|
|
1058
|
-
if (onError) {
|
|
1059
|
-
onError.apply(undefined, arguments);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}, {
|
|
1063
|
-
key: 'handleKeypress',
|
|
1064
|
-
value: function handleKeypress() {}
|
|
1065
|
-
}, {
|
|
1066
|
-
key: 'audioVisualizer',
|
|
1067
|
-
value: function audioVisualizer() {
|
|
1068
|
-
// getting audio nodes
|
|
1069
|
-
var context = new AudioContext({
|
|
1070
|
-
latencyHint: 'interactive',
|
|
1071
|
-
sampleRate: 44100
|
|
1072
|
-
});
|
|
1073
|
-
var src = context.createMediaElementSource(this.video);
|
|
1074
|
-
var analyser = context.createAnalyser();
|
|
1075
|
-
|
|
1076
|
-
//visualising audio nodes on canvas
|
|
1077
|
-
var canvas = this.canvas;
|
|
1078
|
-
canvas.width = this.playerBlock.offsetWidth;
|
|
1079
|
-
canvas.height = this.playerBlock.offsetHeight;
|
|
1080
|
-
var ctx = canvas.getContext('2d');
|
|
1081
|
-
|
|
1082
|
-
src.connect(analyser);
|
|
1083
|
-
analyser.connect(context.destination);
|
|
1084
|
-
|
|
1085
|
-
analyser.fftSize = 256;
|
|
1086
|
-
|
|
1087
|
-
var bufferLength = analyser.frequencyBinCount;
|
|
1088
|
-
|
|
1089
|
-
var dataArray = new Uint8Array(bufferLength);
|
|
1090
|
-
|
|
1091
|
-
var WIDTH = canvas.width;
|
|
1092
|
-
var HEIGHT = canvas.height;
|
|
1093
|
-
|
|
1094
|
-
var barWidth = WIDTH / bufferLength * 1;
|
|
1095
|
-
var barHeight;
|
|
1096
|
-
var x = 0;
|
|
1097
|
-
|
|
1098
|
-
function renderFrame() {
|
|
1099
|
-
requestAnimationFrame(renderFrame);
|
|
1100
|
-
|
|
1101
|
-
x = 0;
|
|
1102
|
-
|
|
1103
|
-
analyser.getByteFrequencyData(dataArray);
|
|
1104
|
-
|
|
1105
|
-
ctx.fillStyle = '#000';
|
|
1106
|
-
ctx.fillRect(0, 0, WIDTH, HEIGHT);
|
|
1107
|
-
|
|
1108
|
-
for (var i = 0; i < bufferLength; i++) {
|
|
1109
|
-
barHeight = dataArray[i] * 2;
|
|
1110
|
-
|
|
1111
|
-
/*
|
|
1112
|
-
* var r = barHeight + (25 * (i / bufferLength));
|
|
1113
|
-
* var g = 250 * (i / bufferLength);
|
|
1114
|
-
* var b = s50;
|
|
1115
|
-
*/
|
|
1116
|
-
|
|
1117
|
-
ctx.fillStyle = '#0c141d'; // 'rgb(' + r + ',' + g + ',' + b + ')';
|
|
1118
|
-
ctx.fillRect(x, HEIGHT - barHeight, barWidth, barHeight);
|
|
1119
|
-
|
|
1120
|
-
x += barWidth + 3;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
renderFrame();
|
|
1125
|
-
}
|
|
1126
|
-
}, {
|
|
1127
|
-
key: 'renderChildren',
|
|
1128
|
-
value: function renderChildren() {
|
|
1129
|
-
var _this4 = this;
|
|
1130
|
-
|
|
1131
|
-
var props = _extends({}, this.props, {
|
|
1132
|
-
video: this.video
|
|
1133
|
-
});
|
|
1134
|
-
var children = this.props.children;
|
|
1135
|
-
// to make sure the children can get video property
|
|
1136
|
-
|
|
1137
|
-
if (!this.video) {
|
|
1138
|
-
return null;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
// only keep <source />, <track />, <MyComponent isVideoChild /> elements
|
|
1142
|
-
return _react2.default.Children.toArray(children).filter(_utils.isVideoChild).map(function (c) {
|
|
1143
|
-
var cprops = void 0;
|
|
1144
|
-
if (typeof c.type === 'string') {
|
|
1145
|
-
// add onError to <source />
|
|
1146
|
-
if (c.type === 'source') {
|
|
1147
|
-
cprops = _extends({}, c.props);
|
|
1148
|
-
var preOnError = cprops.onError;
|
|
1149
|
-
cprops.onError = function () {
|
|
1150
|
-
if (preOnError) {
|
|
1151
|
-
preOnError.apply(undefined, arguments);
|
|
1152
|
-
}
|
|
1153
|
-
_this4.handleError.apply(_this4, arguments);
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
} else {
|
|
1157
|
-
cprops = props;
|
|
1158
|
-
}
|
|
1159
|
-
return _react2.default.cloneElement(c, cprops);
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
}, {
|
|
1163
|
-
key: 'handleSubtitleContainerClick',
|
|
1164
|
-
value: function handleSubtitleContainerClick() {
|
|
1165
|
-
var _props29 = this.props,
|
|
1166
|
-
actions = _props29.actions,
|
|
1167
|
-
player = _props29.player;
|
|
1168
|
-
|
|
1169
|
-
if (player.paused) {
|
|
1170
|
-
actions.play();
|
|
1171
|
-
} else {
|
|
1172
|
-
actions.pause();
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}, {
|
|
1176
|
-
key: 'handleSubtitleClick',
|
|
1177
|
-
value: function handleSubtitleClick(e) {
|
|
1178
|
-
var _props30 = this.props,
|
|
1179
|
-
actions = _props30.actions,
|
|
1180
|
-
player = _props30.player,
|
|
1181
|
-
onScreenSubtitleClick = _props30.onScreenSubtitleClick,
|
|
1182
|
-
controlType = _props30.controlType;
|
|
1183
|
-
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
1184
|
-
|
|
1185
|
-
if (controlType === 'advanced') {
|
|
1186
|
-
if (onScreenSubtitleClick) {
|
|
1187
|
-
onScreenSubtitleClick(currentSubtitleObj);
|
|
1188
|
-
}
|
|
1189
|
-
actions.pause();
|
|
1190
|
-
} else {
|
|
1191
|
-
if (player.paused) {
|
|
1192
|
-
actions.play();
|
|
1193
|
-
} else {
|
|
1194
|
-
actions.pause();
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
actions.handleVideoRewind(false);
|
|
1198
|
-
e.stopPropagation();
|
|
1199
|
-
}
|
|
1200
|
-
}, {
|
|
1201
|
-
key: 'render',
|
|
1202
|
-
value: function render() {
|
|
1203
|
-
var _this5 = this;
|
|
1204
|
-
|
|
1205
|
-
var _props31 = this.props,
|
|
1206
|
-
loop = _props31.loop,
|
|
1207
|
-
poster = _props31.poster,
|
|
1208
|
-
preload = _props31.preload,
|
|
1209
|
-
autoPlay = _props31.autoPlay,
|
|
1210
|
-
playsInline = _props31.playsInline,
|
|
1211
|
-
muted = _props31.muted,
|
|
1212
|
-
crossOrigin = _props31.crossOrigin,
|
|
1213
|
-
videoId = _props31.videoId,
|
|
1214
|
-
fileType = _props31.fileType,
|
|
1215
|
-
userEmail = _props31.userEmail;
|
|
1216
|
-
var _state2 = this.state,
|
|
1217
|
-
isBuffering = _state2.isBuffering,
|
|
1218
|
-
watermark = _state2.watermark,
|
|
1219
|
-
currentSubtitleObj = _state2.currentSubtitleObj;
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
var children = this.getChildren(this.props);
|
|
1223
|
-
return _react2.default.createElement(
|
|
1224
|
-
VideoBlock,
|
|
1225
|
-
{
|
|
1226
|
-
className: 'video-react-player-block',
|
|
1227
|
-
ref: function ref(c) {
|
|
1228
|
-
_this5.playerBlock = c;
|
|
1229
|
-
},
|
|
1230
|
-
style: this.getStyle() },
|
|
1231
|
-
isBuffering && _react2.default.createElement(
|
|
1232
|
-
'div',
|
|
1233
|
-
{
|
|
1234
|
-
className: 'loader-container',
|
|
1235
|
-
onClick: function onClick() {
|
|
1236
|
-
return _this5.togglePlay();
|
|
1237
|
-
}
|
|
1238
|
-
},
|
|
1239
|
-
_react2.default.createElement(_components.Loader, { loaderName: 'SpinningLoader' })
|
|
1240
|
-
) || null,
|
|
1241
|
-
fileType === 'audio' ? _react2.default.createElement(
|
|
1242
|
-
_react2.default.Fragment,
|
|
1243
|
-
null,
|
|
1244
|
-
_react2.default.createElement('canvas', {
|
|
1245
|
-
id: 'canvas',
|
|
1246
|
-
ref: function ref(c) {
|
|
1247
|
-
_this5.canvas = c;
|
|
1248
|
-
},
|
|
1249
|
-
style: {
|
|
1250
|
-
top: 0,
|
|
1251
|
-
left: 0,
|
|
1252
|
-
position: 'absolute'
|
|
1253
|
-
}
|
|
1254
|
-
}),
|
|
1255
|
-
_react2.default.createElement(
|
|
1256
|
-
'audio',
|
|
1257
|
-
{
|
|
1258
|
-
id: videoId,
|
|
1259
|
-
crossOrigin: 'anonymous',
|
|
1260
|
-
ref: function ref(c) {
|
|
1261
|
-
_this5.video = c;
|
|
1262
|
-
},
|
|
1263
|
-
muted: muted,
|
|
1264
|
-
preload: preload,
|
|
1265
|
-
loop: loop,
|
|
1266
|
-
playsInline: playsInline,
|
|
1267
|
-
autoPlay: autoPlay,
|
|
1268
|
-
poster: poster,
|
|
1269
|
-
onLoadStart: this.handleLoadStart,
|
|
1270
|
-
onWaiting: this.handleWaiting,
|
|
1271
|
-
onCanPlay: this.handleCanPlay,
|
|
1272
|
-
onCanPlayThrough: this.handleCanPlayThrough,
|
|
1273
|
-
onPlaying: this.handlePlaying,
|
|
1274
|
-
onEnded: this.handleEnded,
|
|
1275
|
-
onSeeking: this.handleSeeking,
|
|
1276
|
-
onSeeked: this.handleSeeked,
|
|
1277
|
-
onPlay: this.handlePlay,
|
|
1278
|
-
onPause: this.handlePause,
|
|
1279
|
-
onProgress: this.handleProgress,
|
|
1280
|
-
onDurationChange: this.handleDurationChange,
|
|
1281
|
-
onError: this.handleError,
|
|
1282
|
-
onSuspend: this.handleSuspend,
|
|
1283
|
-
onAbort: this.handleAbort,
|
|
1284
|
-
onEmptied: this.handleEmptied,
|
|
1285
|
-
onStalled: this.handleStalled,
|
|
1286
|
-
onLoadedMetadata: this.handleLoadedMetaData,
|
|
1287
|
-
onLoadedData: this.handleLoadedData,
|
|
1288
|
-
onTimeUpdate: this.handleTimeUpdate,
|
|
1289
|
-
onRateChange: this.handleRateChange,
|
|
1290
|
-
onVolumeChange: this.handleVolumeChange
|
|
1291
|
-
},
|
|
1292
|
-
_react2.default.createElement('track', { kind: 'captions' }),
|
|
1293
|
-
this.renderChildren()
|
|
1294
|
-
)
|
|
1295
|
-
) : _react2.default.createElement(
|
|
1296
|
-
'video',
|
|
1297
|
-
{
|
|
1298
|
-
id: videoId,
|
|
1299
|
-
crossOrigin: crossOrigin,
|
|
1300
|
-
ref: function ref(c) {
|
|
1301
|
-
_this5.video = c;
|
|
1302
|
-
},
|
|
1303
|
-
muted: muted,
|
|
1304
|
-
preload: preload,
|
|
1305
|
-
loop: loop,
|
|
1306
|
-
playsInline: playsInline,
|
|
1307
|
-
autoPlay: autoPlay,
|
|
1308
|
-
poster: poster,
|
|
1309
|
-
onLoadStart: this.handleLoadStart,
|
|
1310
|
-
onWaiting: this.handleWaiting,
|
|
1311
|
-
onCanPlay: this.handleCanPlay,
|
|
1312
|
-
onCanPlayThrough: this.handleCanPlayThrough,
|
|
1313
|
-
onPlaying: this.handlePlaying,
|
|
1314
|
-
onEnded: this.handleEnded,
|
|
1315
|
-
onSeeking: this.handleSeeking,
|
|
1316
|
-
onSeeked: this.handleSeeked,
|
|
1317
|
-
onPlay: this.handlePlay,
|
|
1318
|
-
onPause: this.handlePause,
|
|
1319
|
-
onProgress: this.handleProgress,
|
|
1320
|
-
onDurationChange: this.handleDurationChange,
|
|
1321
|
-
onError: this.handleError,
|
|
1322
|
-
onSuspend: this.handleSuspend,
|
|
1323
|
-
onAbort: this.handleAbort,
|
|
1324
|
-
onEmptied: this.handleEmptied,
|
|
1325
|
-
onStalled: this.handleStalled,
|
|
1326
|
-
onLoadedMetadata: this.handleLoadedMetaData,
|
|
1327
|
-
onLoadedData: this.handleLoadedData,
|
|
1328
|
-
onTimeUpdate: this.handleTimeUpdate,
|
|
1329
|
-
onRateChange: this.handleRateChange,
|
|
1330
|
-
onVolumeChange: this.handleVolumeChange
|
|
1331
|
-
},
|
|
1332
|
-
_react2.default.createElement('track', { kind: 'captions' }),
|
|
1333
|
-
this.renderChildren()
|
|
1334
|
-
),
|
|
1335
|
-
children,
|
|
1336
|
-
_react2.default.createElement(
|
|
1337
|
-
'p',
|
|
1338
|
-
{ className: 'user-name-wrapper', id: 'watermark-text', style: _extends({}, watermark) },
|
|
1339
|
-
userEmail
|
|
1340
|
-
),
|
|
1341
|
-
currentSubtitleObj && currentSubtitleObj.line1 && currentSubtitleObj.line1.length && _react2.default.createElement(
|
|
1342
|
-
SubTitleSection,
|
|
1343
|
-
{ id: 'outer', onClick: function onClick() {
|
|
1344
|
-
return _this5.handleSubtitleContainerClick();
|
|
1345
|
-
} },
|
|
1346
|
-
_react2.default.createElement(
|
|
1347
|
-
'span',
|
|
1348
|
-
{ onClick: function onClick(e) {
|
|
1349
|
-
return _this5.handleSubtitleClick(e);
|
|
1350
|
-
}, className: 'subtitleContainer', style: _extends({}, currentSubtitleObj.style) },
|
|
1351
|
-
currentSubtitleObj.line1 && _react2.default.createElement(
|
|
1352
|
-
'pre',
|
|
1353
|
-
null,
|
|
1354
|
-
' ',
|
|
1355
|
-
currentSubtitleObj.line1,
|
|
1356
|
-
' '
|
|
1357
|
-
) || null,
|
|
1358
|
-
currentSubtitleObj.line2 && _react2.default.createElement(
|
|
1359
|
-
'pre',
|
|
1360
|
-
null,
|
|
1361
|
-
' ',
|
|
1362
|
-
currentSubtitleObj.line2,
|
|
1363
|
-
' '
|
|
1364
|
-
) || null
|
|
1365
|
-
)
|
|
1366
|
-
)
|
|
1367
|
-
);
|
|
1368
|
-
}
|
|
1369
|
-
}, {
|
|
1370
|
-
key: 'playbackRate',
|
|
1371
|
-
get: function get() {
|
|
1372
|
-
return this.video.playbackRate;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
/*
|
|
1376
|
-
* set playback rate
|
|
1377
|
-
* speed of video
|
|
1378
|
-
*/
|
|
1379
|
-
,
|
|
1380
|
-
set: function set(rate) {
|
|
1381
|
-
this.video.playbackRate = rate;
|
|
1382
|
-
}
|
|
1383
|
-
}, {
|
|
1384
|
-
key: 'muted',
|
|
1385
|
-
get: function get() {
|
|
1386
|
-
return this.video.muted;
|
|
1387
|
-
},
|
|
1388
|
-
set: function set(val) {
|
|
1389
|
-
this.video.muted = val;
|
|
1390
|
-
}
|
|
1391
|
-
}, {
|
|
1392
|
-
key: 'volume',
|
|
1393
|
-
get: function get() {
|
|
1394
|
-
return this.video.volume;
|
|
1395
|
-
},
|
|
1396
|
-
set: function set(val) {
|
|
1397
|
-
if (val > 1) {
|
|
1398
|
-
val = 1;
|
|
1399
|
-
}
|
|
1400
|
-
if (val < 0) {
|
|
1401
|
-
val = 0;
|
|
1402
|
-
}
|
|
1403
|
-
this.video.volume = val;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
// video width
|
|
1407
|
-
|
|
1408
|
-
}, {
|
|
1409
|
-
key: 'videoWidth',
|
|
1410
|
-
get: function get() {
|
|
1411
|
-
return this.video.videoWidth;
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
// video height
|
|
1415
|
-
|
|
1416
|
-
}, {
|
|
1417
|
-
key: 'videoHeight',
|
|
1418
|
-
get: function get() {
|
|
1419
|
-
return this.video.videoHeight;
|
|
1420
|
-
}
|
|
1421
|
-
}]);
|
|
1422
|
-
|
|
1423
|
-
return Video;
|
|
1424
|
-
}(_react.Component);
|
|
1425
|
-
|
|
1426
|
-
exports.default = Video;
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
Video.propTypes = propTypes;
|
|
1430
|
-
Video.defaultProps = defaultProps;
|
|
1431
|
-
Video.displayName = 'Video';
|