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