@desynova-digital/player 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Manager.js +99 -0
- package/actions/player.js +331 -0
- package/actions/video.js +206 -0
- package/{utils/colors.js → colors.js} +1 -2
- package/{media → components}/AudioMeter.js +96 -109
- package/components/BigPlayButton.js +84 -0
- package/components/ImageViewer.js +272 -0
- package/{control → components}/MarkerBar.js +33 -24
- package/{utils → components}/Menu.js +13 -4
- package/components/Player.js +706 -0
- package/{header/Header.js → components/PlayerHeader.js} +104 -78
- package/components/Playlist.js +95 -0
- package/{control → components}/PointersBar.js +122 -61
- package/components/PosterImage.js +50 -0
- package/{media → components}/SDOutline.js +13 -49
- package/components/Shortcut.js +821 -0
- package/{control → components}/Slider.js +27 -23
- package/components/TagsBar.js +81 -0
- package/components/Video.js +1280 -0
- package/{control → components/control-bar}/AudioTracksMenuButton.js +32 -28
- package/components/control-bar/CameraButton.js +75 -0
- package/components/control-bar/CommentsButton.js +186 -0
- package/components/control-bar/ControlBar.js +266 -0
- package/components/control-bar/EditorControlMenuButton.js +317 -0
- package/components/control-bar/ForwardControl.js +12 -0
- package/components/control-bar/ForwardReplayControl.js +106 -0
- package/{control → components/control-bar}/FullscreenToggle.js +26 -21
- package/components/control-bar/PlayToggle.js +85 -0
- package/components/control-bar/ReplayControl.js +12 -0
- package/components/control-bar/SettingsMenuButton.js +41 -0
- package/components/control-bar/SubtitleLanguagesMenuButton.js +149 -0
- package/components/control-bar/SubtitleMovementMenu.js +140 -0
- package/{control/VolumneMenuButton.js → components/control-bar/VolumeMenuButton.js} +26 -27
- package/components/control-bar/ZoomMenuButton.js +90 -0
- package/{control → components/marking-controls}/MarkInControl.js +32 -25
- package/{control → components/marking-controls}/MarkOutControl.js +35 -26
- package/components/marking-controls/MarkingAddButton.js +79 -0
- package/components/marking-controls/MarkingControl.js +95 -0
- package/components/marking-controls/MarkingDeleteButton.js +70 -0
- package/{control → components/marking-controls}/MarkingDuration.js +12 -5
- package/components/marking-controls/MarkingPreview.js +72 -0
- package/components/progress-bar/AudioWaveform.js +126 -0
- package/components/progress-bar/LoadProgressBar.js +67 -0
- package/components/progress-bar/MouseTimeDisplay.js +36 -0
- package/{control → components/progress-bar}/PlayProgressBar.js +4 -4
- package/components/progress-bar/ProgressControl.js +186 -0
- package/{control → components/progress-bar}/SeekBar.js +113 -72
- package/{control → components/progress-bar}/Timeline.js +43 -32
- package/{control/PlayBackRateControl.js → components/settings-menu-control/PlaybackRateControl.js} +44 -30
- package/components/settings-menu-control/SafeAreaControl.js +81 -0
- package/components/settings-menu-control/SettingsMenu.js +56 -0
- package/components/settings-menu-control/SubtitleControl.js +1 -0
- package/components/time-controls/CurrentTimeDisplay.js +83 -0
- package/{control → components/time-controls}/DurationDisplay.js +8 -15
- package/components/time-controls/TimeDivider.js +25 -0
- package/{control → components/volume-control}/VolumeBar.js +62 -80
- package/components/volume-control/VolumeControl.js +19 -0
- package/{control → components/volume-control}/VolumeLevel.js +2 -3
- package/components/zoom-control/ZoomBar.js +155 -0
- package/components/zoom-control/ZoomLevel.js +55 -0
- package/index.js +198 -1
- package/package.json +5 -8
- package/reducers/index.js +19 -0
- package/reducers/operation.js +35 -0
- package/reducers/player.js +222 -0
- package/utils/browser.js +30 -0
- package/utils/dom.js +1 -2
- package/utils/fullscreen.js +72 -0
- package/utils/index.js +156 -57
- package/Player.js +0 -945
- package/control/AudioTracksMenuButton.jsx +0 -80
- package/control/ControlBar.js +0 -303
- package/control/ControlBar.jsx +0 -264
- package/control/CurrentTimeDisplay.js +0 -34
- package/control/CurrentTimeDisplay.jsx +0 -35
- package/control/DurationDisplay.jsx +0 -48
- package/control/ForwardBackwardControl.js +0 -76
- package/control/ForwardBackwardControl.jsx +0 -79
- package/control/FullscreenToggle.jsx +0 -83
- package/control/MarkInControl.jsx +0 -109
- package/control/MarkOutControl.jsx +0 -131
- package/control/MarkerBar.jsx +0 -107
- package/control/MarkingControl.js +0 -82
- package/control/MarkingControl.jsx +0 -143
- package/control/MarkingPreview.js +0 -49
- package/control/MarkingPreview.jsx +0 -60
- package/control/PlayBackRateControl.jsx +0 -106
- package/control/PlayProgressBar.jsx +0 -92
- package/control/PlayToggle.js +0 -56
- package/control/PlayToggle.jsx +0 -57
- package/control/PointersBar.jsx +0 -286
- package/control/ProgressControl.js +0 -127
- package/control/ProgressControl.jsx +0 -155
- package/control/SeekBar.jsx +0 -229
- package/control/SettingsMenuButton.js +0 -63
- package/control/SettingsMenuButton.jsx +0 -69
- package/control/Slider.jsx +0 -243
- package/control/Timeline.jsx +0 -131
- package/control/VolumeBar.jsx +0 -174
- package/control/VolumeLevel.jsx +0 -66
- package/control/VolumneMenuButton.jsx +0 -111
- package/header/Header.jsx +0 -479
- package/media/AudioMeter.jsx +0 -411
- package/media/SDOutline.jsx +0 -90
- package/media/Video.js +0 -684
- package/media/Video.jsx +0 -714
- package/playlist/Playlist.js +0 -67
- package/playlist/Playlist.jsx +0 -91
- package/playlist/index.js +0 -13
- package/shortcuts/Shortcut.js +0 -662
- package/utils/Menu.jsx +0 -105
package/Player.js
DELETED
|
@@ -1,945 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _propTypes = require("prop-types");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _Header = _interopRequireDefault(require("./header/Header"));
|
|
12
|
-
var _Video = _interopRequireDefault(require("./media/Video"));
|
|
13
|
-
var _ControlBar = _interopRequireDefault(require("./control/ControlBar"));
|
|
14
|
-
var _utils = require("./utils");
|
|
15
|
-
var _ProgressControl = _interopRequireDefault(require("./control/ProgressControl"));
|
|
16
|
-
var _playlist = _interopRequireDefault(require("./playlist"));
|
|
17
|
-
var _Shortcut = _interopRequireDefault(require("./shortcuts/Shortcut"));
|
|
18
|
-
var _AudioMeter = _interopRequireDefault(require("./media/AudioMeter"));
|
|
19
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
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); }
|
|
22
|
-
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; }
|
|
23
|
-
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); }
|
|
24
|
-
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; }
|
|
25
|
-
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; }
|
|
26
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
27
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
30
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
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); } }
|
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
-
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); }
|
|
36
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
-
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); }; }
|
|
38
|
-
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); }
|
|
39
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
40
|
-
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; } }
|
|
41
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
-
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; }
|
|
43
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
44
|
-
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); }
|
|
45
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
46
|
-
var propTypes = {
|
|
47
|
-
frameRate: _propTypes.PropTypes.number,
|
|
48
|
-
initialTime: _propTypes.PropTypes.number,
|
|
49
|
-
audioSrc: _propTypes.PropTypes.string,
|
|
50
|
-
autoPlay: _propTypes.PropTypes.bool,
|
|
51
|
-
src: _propTypes.PropTypes.string,
|
|
52
|
-
poster: _propTypes.PropTypes.string,
|
|
53
|
-
videoDetails: _propTypes.PropTypes.instanceOf(Object),
|
|
54
|
-
onPlayerClose: _propTypes.PropTypes.func,
|
|
55
|
-
onCommentsAdd: _propTypes.PropTypes.func,
|
|
56
|
-
fileType: _propTypes.PropTypes.oneOf(['video', 'image', 'audio']),
|
|
57
|
-
assetType: _propTypes.PropTypes.oneOf(['fc', 'rc']),
|
|
58
|
-
markers: _propTypes.PropTypes.instanceOf(Array),
|
|
59
|
-
playlist: _propTypes.PropTypes.instanceOf(Array),
|
|
60
|
-
playlistClick: _propTypes.PropTypes.func,
|
|
61
|
-
rightSection: _propTypes.PropTypes.node
|
|
62
|
-
};
|
|
63
|
-
var defaultProps = {
|
|
64
|
-
frameRate: 25,
|
|
65
|
-
initialTime: 0,
|
|
66
|
-
fileType: '',
|
|
67
|
-
audioSrc: '',
|
|
68
|
-
autoPlay: false,
|
|
69
|
-
src: '',
|
|
70
|
-
poster: '',
|
|
71
|
-
videoDetails: {
|
|
72
|
-
title: ''
|
|
73
|
-
},
|
|
74
|
-
assetType: 'fc'
|
|
75
|
-
};
|
|
76
|
-
var PlayerBlock = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n background: #121212;\n"])));
|
|
77
|
-
var PlayerContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-start;\n background: #000000;\n .left-video-section {\n width: ", ";\n position: relative;\n height: fit-content;\n .comments-playlist-block {\n background: #121212;\n height: 18rem;\n padding: ", ";\n border-top: 0.3rem solid #122a4a;\n box-sizing: border-box;\n }\n }\n .audio-meter-block {\n position: relative;\n width: 0px;\n display: none;\n &.qc {\n width: 70px;\n display: block;\n }\n }\n .right-video-section {\n width: ", ";\n position: relative;\n }\n"])), function (props) {
|
|
78
|
-
if (props.hasRightSection) {
|
|
79
|
-
return '63.67%';
|
|
80
|
-
}
|
|
81
|
-
return '100%';
|
|
82
|
-
}, function (props) {
|
|
83
|
-
return props.playlistVisible ? '0 2rem' : '2rem 2rem 3.5rem 2rem';
|
|
84
|
-
}, function (props) {
|
|
85
|
-
if (props.playerType === 'qc') {
|
|
86
|
-
return 'calc(36.33% - 70px)';
|
|
87
|
-
} else {
|
|
88
|
-
return '36.33%';
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
var AudioMeterBlock = (0, _styledComponents["default"])('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n position: absolute;\n bottom: ", ";\n left: ", ";\n padding: ", ";\n box-sizing: border-box;\n background: ", ";\n border-radius: ", ";\n display: ", ";\n margin: ", ";\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"])), function (props) {
|
|
92
|
-
return !props.active ? '50px' : '55px';
|
|
93
|
-
}, function (props) {
|
|
94
|
-
return !props.active ? '50px !important' : 'calc(100% - 40px)';
|
|
95
|
-
}, function (props) {
|
|
96
|
-
return !props.active ? '5px' : '0px';
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return !props.active ? '5px' : '0px';
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return !props.active ? '5px' : '0px';
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return !props.active ? 'rgba(243, 243, 243, 0.5)' : 'rgba(0, 0, 0, 1)';
|
|
103
|
-
}, function (props) {
|
|
104
|
-
return !props.active ? '5px' : '0px';
|
|
105
|
-
}, function (props) {
|
|
106
|
-
return !props.active ? 'block' : 'inline-block';
|
|
107
|
-
}, function (props) {
|
|
108
|
-
return !props.active ? '0' : '20px 0';
|
|
109
|
-
});
|
|
110
|
-
var Player = /*#__PURE__*/function (_Component) {
|
|
111
|
-
_inherits(Player, _Component);
|
|
112
|
-
var _super = _createSuper(Player);
|
|
113
|
-
function Player(props) {
|
|
114
|
-
var _this;
|
|
115
|
-
_classCallCheck(this, Player);
|
|
116
|
-
_this = _super.call(this, props);
|
|
117
|
-
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
118
|
-
var self = _assertThisInitialized(_this);
|
|
119
|
-
var isFullscreen = _this.state.isFullscreen;
|
|
120
|
-
_this.handleResize();
|
|
121
|
-
window.addEventListener('resize', _this.handleResize);
|
|
122
|
-
document.addEventListener('webkitfullscreenchange', function (e) {
|
|
123
|
-
self.setState(function (state) {
|
|
124
|
-
return {
|
|
125
|
-
isFullscreen: !state.isFullscreen
|
|
126
|
-
};
|
|
127
|
-
}, function () {
|
|
128
|
-
self.handleResize();
|
|
129
|
-
});
|
|
130
|
-
}, false);
|
|
131
|
-
document.addEventListener('mozfullscreenchange', function (e) {
|
|
132
|
-
self.setState(function (state) {
|
|
133
|
-
return {
|
|
134
|
-
isFullscreen: !state.isFullscreen
|
|
135
|
-
};
|
|
136
|
-
}, function () {
|
|
137
|
-
self.handleResize();
|
|
138
|
-
});
|
|
139
|
-
}, false);
|
|
140
|
-
document.addEventListener('fullscreenchange', function (e) {
|
|
141
|
-
self.setState(function (state) {
|
|
142
|
-
return {
|
|
143
|
-
isFullscreen: !state.isFullscreen
|
|
144
|
-
};
|
|
145
|
-
}, function () {
|
|
146
|
-
self.handleResize();
|
|
147
|
-
});
|
|
148
|
-
}, false);
|
|
149
|
-
document.addEventListener('MSFullscreenChange', function (e) {
|
|
150
|
-
self.setState(function (state) {
|
|
151
|
-
return {
|
|
152
|
-
isFullscreen: !state.isFullscreen
|
|
153
|
-
};
|
|
154
|
-
}, function () {
|
|
155
|
-
self.handleResize();
|
|
156
|
-
});
|
|
157
|
-
}, false);
|
|
158
|
-
});
|
|
159
|
-
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function () {
|
|
160
|
-
_this.handleResize();
|
|
161
|
-
});
|
|
162
|
-
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
|
|
163
|
-
var self = _assertThisInitialized(_this);
|
|
164
|
-
var isFullscreen = _this.state.isFullscreen;
|
|
165
|
-
// Remove event listener
|
|
166
|
-
window.removeEventListener('resize', _this.handleResize);
|
|
167
|
-
document.removeEventListener('webkitfullscreenchange', function (e) {
|
|
168
|
-
self.setState(function (state) {
|
|
169
|
-
return {
|
|
170
|
-
isFullscreen: !state.isFullscreen
|
|
171
|
-
};
|
|
172
|
-
}, function () {
|
|
173
|
-
self.handleResize();
|
|
174
|
-
});
|
|
175
|
-
}, false);
|
|
176
|
-
document.removeEventListener('mozfullscreenchange', function (e) {
|
|
177
|
-
self.setState(function (state) {
|
|
178
|
-
return {
|
|
179
|
-
isFullscreen: !state.isFullscreen
|
|
180
|
-
};
|
|
181
|
-
}, function () {
|
|
182
|
-
self.handleResize();
|
|
183
|
-
});
|
|
184
|
-
}, false);
|
|
185
|
-
document.removeEventListener('fullscreenchange', function (e) {
|
|
186
|
-
self.setState(function (state) {
|
|
187
|
-
return {
|
|
188
|
-
isFullscreen: !state.isFullscreen
|
|
189
|
-
};
|
|
190
|
-
}, function () {
|
|
191
|
-
self.handleResize();
|
|
192
|
-
});
|
|
193
|
-
}, false);
|
|
194
|
-
document.removeEventListener('MSFullscreenChange', function (e) {
|
|
195
|
-
self.setState(function (state) {
|
|
196
|
-
return {
|
|
197
|
-
isFullscreen: !state.isFullscreen
|
|
198
|
-
};
|
|
199
|
-
}, function () {
|
|
200
|
-
self.handleResize();
|
|
201
|
-
});
|
|
202
|
-
}, false);
|
|
203
|
-
});
|
|
204
|
-
// player resize
|
|
205
|
-
_defineProperty(_assertThisInitialized(_this), "handleResize", function () {
|
|
206
|
-
var isFullscreen = _this.state.isFullscreen;
|
|
207
|
-
var leftSectionHeight = 0;
|
|
208
|
-
var rightSectionRef = document.getElementById('right-section');
|
|
209
|
-
_toConsumableArray(_this.leftSectionRef.children).forEach(function (child) {
|
|
210
|
-
leftSectionHeight += child.offsetHeight;
|
|
211
|
-
});
|
|
212
|
-
if (rightSectionRef) {
|
|
213
|
-
rightSectionRef.style.height = leftSectionHeight + 'px';
|
|
214
|
-
}
|
|
215
|
-
var assetMedia = document.getElementById('media-container');
|
|
216
|
-
var audioMeterContainer = document.getElementById('audio-meter-block');
|
|
217
|
-
var controlsContainer = document.getElementById('controls-container');
|
|
218
|
-
var headerContainer = document.getElementById('header-container');
|
|
219
|
-
var playlistContainer = document.getElementById('comments-playlist');
|
|
220
|
-
var mediaBlock = document.getElementById('media-controls-block');
|
|
221
|
-
if (audioMeterContainer && headerContainer) {
|
|
222
|
-
audioMeterContainer.style.height = _this.mediaRef.video.offsetHeight + 'px';
|
|
223
|
-
audioMeterContainer.style.top = headerContainer.offsetHeight + 'px';
|
|
224
|
-
_this.meterHeight = _this.mediaRef.video.offsetHeight;
|
|
225
|
-
}
|
|
226
|
-
if (leftSectionHeight >= window.innerHeight - 15) {
|
|
227
|
-
if (!isFullscreen) {
|
|
228
|
-
var videoHeight = window.innerHeight - (controlsContainer === null || controlsContainer === void 0 ? void 0 : controlsContainer.offsetHeight) - (headerContainer === null || headerContainer === void 0 ? void 0 : headerContainer.offsetHeight) - ((playlistContainer === null || playlistContainer === void 0 ? void 0 : playlistContainer.offsetHeight) || 0) - 10;
|
|
229
|
-
var videoWidth = videoHeight * (16 / 9);
|
|
230
|
-
assetMedia.style.paddingTop = '0';
|
|
231
|
-
assetMedia.style.width = videoWidth + 'px';
|
|
232
|
-
assetMedia.style.height = videoHeight + 'px';
|
|
233
|
-
assetMedia.style.margin = '0 auto';
|
|
234
|
-
assetMedia.classList.add('ratio-border');
|
|
235
|
-
} else {
|
|
236
|
-
assetMedia.style.paddingTop = '0';
|
|
237
|
-
assetMedia.style.width = '100%';
|
|
238
|
-
assetMedia.style.height = "calc(100% - ".concat(controlsContainer.offsetHeight, "px)");
|
|
239
|
-
assetMedia.style.margin = '0 auto';
|
|
240
|
-
assetMedia.classList.add('ratio-border');
|
|
241
|
-
}
|
|
242
|
-
} else if (leftSectionHeight + playlistContainer.offsetHeight > window.innerHeight) {
|
|
243
|
-
console.log('playlist case');
|
|
244
|
-
var height = window.innerHeight - headerContainer.offsetHeight - controlsContainer.offsetHeight - playlistContainer.offsetHeight - 40;
|
|
245
|
-
mediaBlock.style.height = height + 'px';
|
|
246
|
-
mediaBlock.style.width = height * (16 / 9) + 'px';
|
|
247
|
-
mediaBlock.style.margin = '0 auto';
|
|
248
|
-
} else {
|
|
249
|
-
assetMedia.style.paddingTop = '56.25%';
|
|
250
|
-
assetMedia.style.width = 'auto';
|
|
251
|
-
assetMedia.style.height = 'auto';
|
|
252
|
-
assetMedia.classList.add('ratio-border');
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
_defineProperty(_assertThisInitialized(_this), "toggleFullscreen", function () {
|
|
256
|
-
var isFullscreen = _this.state.isFullscreen;
|
|
257
|
-
var playerBlock = document.getElementById('media-controls-block');
|
|
258
|
-
if (!isFullscreen) {
|
|
259
|
-
if (playerBlock.requestFullscreen) {
|
|
260
|
-
playerBlock.requestFullscreen()["catch"](function (err) {
|
|
261
|
-
console.log('err fullscreen', err);
|
|
262
|
-
});
|
|
263
|
-
} else if (document.documentElement.msRequestFullscreen) {
|
|
264
|
-
playerBlock.msRequestFullscreen()["catch"](function (err) {
|
|
265
|
-
console.log('err fullscreen', err);
|
|
266
|
-
});
|
|
267
|
-
} else if (playerBlock.mozRequestFullScreen) {
|
|
268
|
-
playerBlock.mozRequestFullScreen()["catch"](function (err) {
|
|
269
|
-
console.log('err fullscreen', err);
|
|
270
|
-
}); // Firefox
|
|
271
|
-
} else if (playerBlock.webkitRequestFullscreen) {
|
|
272
|
-
playerBlock.webkitRequestFullscreen()["catch"](function (err) {
|
|
273
|
-
console.log('err fullscreen', err);
|
|
274
|
-
}); // Chrome and Safari
|
|
275
|
-
}
|
|
276
|
-
} else if (playerBlock.exitFullscreen) {
|
|
277
|
-
document.exitFullscreen();
|
|
278
|
-
} else if (document.msExitFullscreen) {
|
|
279
|
-
document.msExitFullscreen();
|
|
280
|
-
} else if (document.mozCancelFullScreen) {
|
|
281
|
-
document.mozCancelFullScreen();
|
|
282
|
-
} else if (document.webkitExitFullscreen) {
|
|
283
|
-
document.webkitExitFullscreen();
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
_defineProperty(_assertThisInitialized(_this), "actionClick", function (data) {
|
|
287
|
-
var _this$props = _this.props,
|
|
288
|
-
frameRate = _this$props.frameRate,
|
|
289
|
-
initialTime = _this$props.initialTime,
|
|
290
|
-
onCommentsAdd = _this$props.onCommentsAdd,
|
|
291
|
-
playlistClick = _this$props.playlistClick;
|
|
292
|
-
var _this$state = _this.state,
|
|
293
|
-
media = _this$state.media,
|
|
294
|
-
muted = _this$state.muted;
|
|
295
|
-
var playerState = _objectSpread({}, _this.state);
|
|
296
|
-
var actions = {
|
|
297
|
-
play: function play() {
|
|
298
|
-
_this.mediaRef.play();
|
|
299
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
300
|
-
hasStarted: true,
|
|
301
|
-
paused: false
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
pause: function pause() {
|
|
305
|
-
_this.mediaRef.pause();
|
|
306
|
-
// this.mediaRef.playbackRate = 1;
|
|
307
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
308
|
-
// playbackRate: 1,
|
|
309
|
-
videoRewind: false,
|
|
310
|
-
paused: true
|
|
311
|
-
});
|
|
312
|
-
},
|
|
313
|
-
handle_video_preview: function handle_video_preview() {
|
|
314
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
315
|
-
previewActive: data.value
|
|
316
|
-
});
|
|
317
|
-
},
|
|
318
|
-
handle_sd_border_change: function handle_sd_border_change() {
|
|
319
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
320
|
-
SDBorderActive: data.value
|
|
321
|
-
});
|
|
322
|
-
},
|
|
323
|
-
handle_audio_tracks: function handle_audio_tracks() {
|
|
324
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
325
|
-
audioTracksArr: data.value
|
|
326
|
-
});
|
|
327
|
-
},
|
|
328
|
-
handle_audio_track_change: function handle_audio_track_change() {
|
|
329
|
-
_this.mediaRef.hls.audioTrack = data.value.id;
|
|
330
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
331
|
-
activeAudio: data.value
|
|
332
|
-
});
|
|
333
|
-
},
|
|
334
|
-
playback_rate_change: function playback_rate_change() {
|
|
335
|
-
_this.mediaRef.video.playbackRate = data.value;
|
|
336
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
337
|
-
playbackRate: data.value
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
set_media: function set_media() {
|
|
341
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
342
|
-
media: data.value
|
|
343
|
-
});
|
|
344
|
-
},
|
|
345
|
-
handle_pause: function handle_pause() {
|
|
346
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
347
|
-
mediaPlaying: false
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
handle_ended: function handle_ended() {
|
|
351
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
352
|
-
mediaPlaying: false
|
|
353
|
-
});
|
|
354
|
-
},
|
|
355
|
-
handle_play: function handle_play() {
|
|
356
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
357
|
-
mediaPlaying: true,
|
|
358
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
359
|
-
value: 'new',
|
|
360
|
-
active: false,
|
|
361
|
-
type: 'brush',
|
|
362
|
-
undo: false,
|
|
363
|
-
redo: false
|
|
364
|
-
}),
|
|
365
|
-
annotations: []
|
|
366
|
-
});
|
|
367
|
-
},
|
|
368
|
-
handle_loaded_meta_data: function handle_loaded_meta_data() {
|
|
369
|
-
var frameRate = _this.props.frameRate;
|
|
370
|
-
var seconds = data.value;
|
|
371
|
-
var timecode = (0, _utils.secondsToTime)(seconds, frameRate);
|
|
372
|
-
var frame = frameRate; // converter.secondsToFrames(seconds, frameRate);
|
|
373
|
-
// const standard = converter.secondsToTime(seconds);
|
|
374
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
375
|
-
duration: {
|
|
376
|
-
timecode: timecode,
|
|
377
|
-
frame: frame,
|
|
378
|
-
// standard,
|
|
379
|
-
seconds: seconds
|
|
380
|
-
},
|
|
381
|
-
isActive: true
|
|
382
|
-
});
|
|
383
|
-
},
|
|
384
|
-
handle_time_update: function handle_time_update() {
|
|
385
|
-
var _this$state2 = _this.state,
|
|
386
|
-
duration = _this$state2.duration,
|
|
387
|
-
currentTime = _this$state2.currentTime;
|
|
388
|
-
var seconds;
|
|
389
|
-
if (data.value > duration.seconds) {
|
|
390
|
-
seconds = duration.seconds;
|
|
391
|
-
} else seconds = data.value;
|
|
392
|
-
var timecode = (0, _utils.secondsToTime)(seconds, frameRate, initialTime);
|
|
393
|
-
var frame = currentTime.frame; // converter.secondsToFrames(seconds, frameRate);
|
|
394
|
-
// const standard = converter.secondsToTime(seconds);
|
|
395
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
396
|
-
currentTime: {
|
|
397
|
-
timecode: timecode,
|
|
398
|
-
frame: frame,
|
|
399
|
-
// standard,
|
|
400
|
-
seconds: seconds
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
},
|
|
404
|
-
seek: function seek() {
|
|
405
|
-
var _this$state3 = _this.state,
|
|
406
|
-
duration = _this$state3.duration,
|
|
407
|
-
currentTime = _this$state3.currentTime;
|
|
408
|
-
var seconds;
|
|
409
|
-
if (data.value > duration.seconds) {
|
|
410
|
-
seconds = duration.seconds;
|
|
411
|
-
} else seconds = data.value;
|
|
412
|
-
var timecode = currentTime.frame; // secondsToTime(seconds, frameRate, initialTime);
|
|
413
|
-
var frame = currentTime.frame; // converter.secondsToFrames(seconds, frameRate);
|
|
414
|
-
// const standard = converter.secondsToTime(seconds);
|
|
415
|
-
_this.mediaRef.video.currentTime = seconds;
|
|
416
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
417
|
-
currentTime: {
|
|
418
|
-
timecode: timecode,
|
|
419
|
-
frame: frame,
|
|
420
|
-
// standard,
|
|
421
|
-
seconds: seconds
|
|
422
|
-
},
|
|
423
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
424
|
-
value: 'new',
|
|
425
|
-
active: false,
|
|
426
|
-
type: 'brush',
|
|
427
|
-
undo: false,
|
|
428
|
-
redo: false
|
|
429
|
-
}),
|
|
430
|
-
annotations: []
|
|
431
|
-
});
|
|
432
|
-
},
|
|
433
|
-
seeking_time: function seeking_time() {
|
|
434
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
435
|
-
seekingTime: data.value
|
|
436
|
-
});
|
|
437
|
-
},
|
|
438
|
-
add_seconds: function add_seconds() {
|
|
439
|
-
var _this$state4 = _this.state,
|
|
440
|
-
duration = _this$state4.duration,
|
|
441
|
-
currentTime = _this$state4.currentTime;
|
|
442
|
-
var seconds = currentTime.seconds + data.value;
|
|
443
|
-
var timecode = (0, _utils.secondsToTime)(seconds, frameRate, initialTime);
|
|
444
|
-
var frame = currentTime.frame; // converter.secondsToFrames(seconds, frameRate);
|
|
445
|
-
// const standard = converter.secondsToTime(seconds);
|
|
446
|
-
_this.mediaRef.video.currentTime = seconds;
|
|
447
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
448
|
-
currentTime: {
|
|
449
|
-
timecode: timecode,
|
|
450
|
-
frame: frame,
|
|
451
|
-
// standard,
|
|
452
|
-
seconds: seconds
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
},
|
|
456
|
-
handle_image_load_data: function handle_image_load_data() {
|
|
457
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
458
|
-
imageData: {
|
|
459
|
-
minWidth: data.value.minWidth,
|
|
460
|
-
maxWidth: data.value.maxWidth,
|
|
461
|
-
percentage: data.value.percentage
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
},
|
|
465
|
-
zoom_in: function zoom_in() {
|
|
466
|
-
var percentage = _this.state.imageData.percentage;
|
|
467
|
-
var newPercentage = Math.round(percentage / 10) * 10 + 10;
|
|
468
|
-
newPercentage = newPercentage > 200 ? 200 : newPercentage;
|
|
469
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
470
|
-
imageData: _objectSpread(_objectSpread({}, playerState.imageData), {}, {
|
|
471
|
-
percentage: newPercentage
|
|
472
|
-
})
|
|
473
|
-
});
|
|
474
|
-
},
|
|
475
|
-
zoom_out: function zoom_out() {
|
|
476
|
-
var _this$state$imageData = _this.state.imageData,
|
|
477
|
-
percentage = _this$state$imageData.percentage,
|
|
478
|
-
minWidth = _this$state$imageData.minWidth,
|
|
479
|
-
maxWidth = _this$state$imageData.maxWidth;
|
|
480
|
-
var minPercent = Math.round(minWidth / maxWidth * 100);
|
|
481
|
-
var newPercentage = Math.round(percentage / 10) * 10 - 10;
|
|
482
|
-
newPercentage = newPercentage < minPercent ? minPercent : newPercentage;
|
|
483
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
484
|
-
imageData: _objectSpread(_objectSpread({}, playerState.imageData), {}, {
|
|
485
|
-
percentage: newPercentage
|
|
486
|
-
})
|
|
487
|
-
});
|
|
488
|
-
},
|
|
489
|
-
fit_to_screen: function fit_to_screen() {
|
|
490
|
-
var _this$state$imageData2 = _this.state.imageData,
|
|
491
|
-
minWidth = _this$state$imageData2.minWidth,
|
|
492
|
-
maxWidth = _this$state$imageData2.maxWidth;
|
|
493
|
-
var minPercent = Math.round(minWidth / maxWidth * 100);
|
|
494
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
495
|
-
imageData: _objectSpread(_objectSpread({}, playerState.imageData), {}, {
|
|
496
|
-
percentage: minPercent
|
|
497
|
-
})
|
|
498
|
-
});
|
|
499
|
-
},
|
|
500
|
-
toggle_playlist: function toggle_playlist() {
|
|
501
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
502
|
-
playlistVisible: !playerState.playlistVisible
|
|
503
|
-
});
|
|
504
|
-
},
|
|
505
|
-
playlist_click: function playlist_click() {
|
|
506
|
-
playlistClick(data.value);
|
|
507
|
-
},
|
|
508
|
-
go_to_comment: function go_to_comment() {
|
|
509
|
-
var seconds = data.value.videotime || 0;
|
|
510
|
-
var timecode = (0, _utils.secondsToTime)(seconds, frameRate, initialTime);
|
|
511
|
-
var frame = converter.secondsToFrames(seconds, frameRate);
|
|
512
|
-
var standard = converter.secondsToTime(seconds);
|
|
513
|
-
media.currentTime = seconds;
|
|
514
|
-
media.pause();
|
|
515
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
516
|
-
currentTime: {
|
|
517
|
-
timecode: timecode,
|
|
518
|
-
frame: frame,
|
|
519
|
-
standard: standard,
|
|
520
|
-
seconds: seconds
|
|
521
|
-
},
|
|
522
|
-
annotation: {
|
|
523
|
-
value: 'comment',
|
|
524
|
-
type: 'brush',
|
|
525
|
-
active: false,
|
|
526
|
-
color: '#ff6c56',
|
|
527
|
-
undo: false,
|
|
528
|
-
redo: false
|
|
529
|
-
},
|
|
530
|
-
annotations: data.value.annotations || []
|
|
531
|
-
});
|
|
532
|
-
},
|
|
533
|
-
comment: function comment() {
|
|
534
|
-
var seconds = media.currentTime;
|
|
535
|
-
var timecode = (0, _utils.secondsToTime)(seconds, frameRate, initialTime);
|
|
536
|
-
var markers = _objectSpread({}, playerState.markers);
|
|
537
|
-
var annotations = _toConsumableArray(playerState.annotations);
|
|
538
|
-
if (markers.left > -1 && markers.right > -1) {
|
|
539
|
-
timecode = "".concat((0, _utils.secondsToTime)(markers.left, frameRate, initialTime), " - ").concat((0, _utils.secondsToTime)(markers.right, frameRate, initialTime));
|
|
540
|
-
seconds = markers.left;
|
|
541
|
-
}
|
|
542
|
-
onCommentsAdd({
|
|
543
|
-
seconds: seconds,
|
|
544
|
-
timecode: timecode,
|
|
545
|
-
comment: data.value,
|
|
546
|
-
annotations: annotations
|
|
547
|
-
});
|
|
548
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
549
|
-
markers: {
|
|
550
|
-
left: -1,
|
|
551
|
-
right: -1
|
|
552
|
-
},
|
|
553
|
-
annotation: {
|
|
554
|
-
value: 'new',
|
|
555
|
-
type: 'brush',
|
|
556
|
-
active: false,
|
|
557
|
-
color: '#ff6c56',
|
|
558
|
-
undo: false,
|
|
559
|
-
redo: false
|
|
560
|
-
},
|
|
561
|
-
annotations: []
|
|
562
|
-
});
|
|
563
|
-
},
|
|
564
|
-
create_marker: function create_marker() {
|
|
565
|
-
media.pause();
|
|
566
|
-
var markers = _objectSpread({}, playerState.markers);
|
|
567
|
-
if (data.value === 'left') {
|
|
568
|
-
if (markers.right < 0 || markers.right > -1 && media.currentTime < markers.right) {
|
|
569
|
-
markers.left = media.currentTime;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
if (data.value === 'right') {
|
|
573
|
-
if (markers.left > -1 && media.currentTime > markers.left) {
|
|
574
|
-
markers.right = media.currentTime;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
578
|
-
markers: markers
|
|
579
|
-
});
|
|
580
|
-
},
|
|
581
|
-
toggle_sd_outline: function toggle_sd_outline() {
|
|
582
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
583
|
-
SDOutline: !playerState.SDOutline
|
|
584
|
-
});
|
|
585
|
-
},
|
|
586
|
-
volume: function volume() {
|
|
587
|
-
_this.mediaRef.video.volume = data.value > 1 ? 1 : data.value;
|
|
588
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
589
|
-
volume: data.value
|
|
590
|
-
});
|
|
591
|
-
},
|
|
592
|
-
mute: function mute() {
|
|
593
|
-
_this.mediaRef.video.muted = !muted;
|
|
594
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
595
|
-
muted: !muted
|
|
596
|
-
});
|
|
597
|
-
},
|
|
598
|
-
reset_marker: function reset_marker() {
|
|
599
|
-
if (data.value === 'exit_fullscreen') {
|
|
600
|
-
_this.toggleFullscreen(!playerState.isFullscreen);
|
|
601
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
602
|
-
markers: {
|
|
603
|
-
left: -1,
|
|
604
|
-
right: -1
|
|
605
|
-
},
|
|
606
|
-
isFullscreen: !playerState.isFullscreen
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
610
|
-
markers: {
|
|
611
|
-
left: -1,
|
|
612
|
-
right: -1
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
},
|
|
616
|
-
show_comments: function show_comments() {
|
|
617
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
618
|
-
commentsVisible: data.value
|
|
619
|
-
});
|
|
620
|
-
},
|
|
621
|
-
new_annotation: function new_annotation() {
|
|
622
|
-
if (playerState.mediaPlaying) {
|
|
623
|
-
media.pause();
|
|
624
|
-
}
|
|
625
|
-
if (playerState.annotation.value === 'new') {
|
|
626
|
-
if (playerState.annotation.active) {
|
|
627
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
628
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
629
|
-
type: data.value
|
|
630
|
-
})
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
if (!playerState.annotation.active) {
|
|
634
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
635
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
636
|
-
active: true,
|
|
637
|
-
type: data.value
|
|
638
|
-
})
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
643
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
644
|
-
value: 'new',
|
|
645
|
-
active: true,
|
|
646
|
-
type: data.value
|
|
647
|
-
}),
|
|
648
|
-
annotations: []
|
|
649
|
-
});
|
|
650
|
-
},
|
|
651
|
-
annotation_color: function annotation_color() {
|
|
652
|
-
if (playerState.mediaPlaying) {
|
|
653
|
-
media.pause();
|
|
654
|
-
}
|
|
655
|
-
if (playerState.annotation.value === 'new') {
|
|
656
|
-
if (playerState.annotation.active) {
|
|
657
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
658
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
659
|
-
color: data.value
|
|
660
|
-
})
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
if (!playerState.annotation.active) {
|
|
664
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
665
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
666
|
-
active: true,
|
|
667
|
-
color: data.value
|
|
668
|
-
})
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
673
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
674
|
-
value: 'new',
|
|
675
|
-
active: true,
|
|
676
|
-
color: data.value
|
|
677
|
-
}),
|
|
678
|
-
annotations: []
|
|
679
|
-
});
|
|
680
|
-
},
|
|
681
|
-
annotation_revert: function annotation_revert() {
|
|
682
|
-
if (playerState.mediaPlaying) {
|
|
683
|
-
media.pause();
|
|
684
|
-
}
|
|
685
|
-
if (playerState.annotation.value === 'new' && playerState.annotation.active && playerState.annotations.length) {
|
|
686
|
-
if (data.value === 'undo') {
|
|
687
|
-
var _annotationsArr = _toConsumableArray(playerState.annotations);
|
|
688
|
-
var _deletedAnnotation = _annotationsArr.filter(function (annotation) {
|
|
689
|
-
return annotation.is_deleted;
|
|
690
|
-
});
|
|
691
|
-
var activeAnnotations = _annotationsArr.filter(function (annotation) {
|
|
692
|
-
return !annotation.is_deleted;
|
|
693
|
-
});
|
|
694
|
-
if (activeAnnotations.length) {
|
|
695
|
-
activeAnnotations[activeAnnotations.length - 1].is_deleted = true;
|
|
696
|
-
}
|
|
697
|
-
_annotationsArr = [].concat(_toConsumableArray(activeAnnotations), _toConsumableArray(_deletedAnnotation));
|
|
698
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
699
|
-
annotations: _annotationsArr,
|
|
700
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
701
|
-
redo: true,
|
|
702
|
-
undo: activeAnnotations.length > 1
|
|
703
|
-
})
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
var annotationsArr = _toConsumableArray(playerState.annotations);
|
|
707
|
-
var deletedAnnotation = annotationsArr.filter(function (annotation) {
|
|
708
|
-
return annotation.is_deleted;
|
|
709
|
-
});
|
|
710
|
-
annotationsArr = annotationsArr.filter(function (annotation) {
|
|
711
|
-
return !annotation.is_deleted;
|
|
712
|
-
});
|
|
713
|
-
deletedAnnotation[0].is_deleted = false;
|
|
714
|
-
annotationsArr = [].concat(_toConsumableArray(annotationsArr), _toConsumableArray(deletedAnnotation));
|
|
715
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
716
|
-
annotations: annotationsArr,
|
|
717
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
718
|
-
redo: deletedAnnotation.length > 1,
|
|
719
|
-
undo: true
|
|
720
|
-
})
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
return _objectSpread({}, playerState);
|
|
724
|
-
},
|
|
725
|
-
toggle_fullscreen: function toggle_fullscreen() {
|
|
726
|
-
_this.toggleFullscreen();
|
|
727
|
-
},
|
|
728
|
-
annotation_update: function annotation_update() {
|
|
729
|
-
var annotationsArr = playerState.annotations.filter(function (annotation) {
|
|
730
|
-
return !annotation.is_deleted;
|
|
731
|
-
});
|
|
732
|
-
return _objectSpread(_objectSpread({}, playerState), {}, {
|
|
733
|
-
annotations: [].concat(_toConsumableArray(annotationsArr), [data.value]),
|
|
734
|
-
annotation: _objectSpread(_objectSpread({}, playerState.annotation), {}, {
|
|
735
|
-
undo: true,
|
|
736
|
-
redo: false
|
|
737
|
-
})
|
|
738
|
-
});
|
|
739
|
-
},
|
|
740
|
-
"default": function _default() {
|
|
741
|
-
// eslint-disable-next-line no-console
|
|
742
|
-
console.log(data);
|
|
743
|
-
return playerState;
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
playerState = actions[data.action] ? actions[data.action]() : actions["default"]();
|
|
747
|
-
_this.setState(_objectSpread({}, playerState));
|
|
748
|
-
});
|
|
749
|
-
_defineProperty(_assertThisInitialized(_this), "onBackPressed", function () {
|
|
750
|
-
var mediaBlock = document.getElementById('media-controls-block');
|
|
751
|
-
mediaBlock.style.height = '';
|
|
752
|
-
mediaBlock.style.width = '';
|
|
753
|
-
mediaBlock.style.margin = '';
|
|
754
|
-
var onPlayerClose = _this.props.onPlayerClose;
|
|
755
|
-
onPlayerClose();
|
|
756
|
-
});
|
|
757
|
-
_this.controlsHideTimer = null;
|
|
758
|
-
_this.asset = null; // the Video component
|
|
759
|
-
_this.meterHeight = 40;
|
|
760
|
-
_this.handleResize = _this.handleResize.bind(_assertThisInitialized(_this));
|
|
761
|
-
_this.state = {
|
|
762
|
-
media: null,
|
|
763
|
-
videoRewind: false,
|
|
764
|
-
currentTime: {
|
|
765
|
-
timecode: '00:00:00:00',
|
|
766
|
-
frame: 0,
|
|
767
|
-
standard: '00:00',
|
|
768
|
-
seconds: 0
|
|
769
|
-
},
|
|
770
|
-
duration: {
|
|
771
|
-
timecode: '00:00:00:00',
|
|
772
|
-
frame: 0,
|
|
773
|
-
standard: '00:00',
|
|
774
|
-
seconds: 0
|
|
775
|
-
},
|
|
776
|
-
imageData: {},
|
|
777
|
-
framePerSecond: 1 / props.frameRate,
|
|
778
|
-
playbackRate: 1,
|
|
779
|
-
volume: 1,
|
|
780
|
-
playlistVisible: false,
|
|
781
|
-
/*
|
|
782
|
-
* markers: {
|
|
783
|
-
* left: -1,
|
|
784
|
-
* right: -1
|
|
785
|
-
* },
|
|
786
|
-
*/
|
|
787
|
-
SDOutline: false,
|
|
788
|
-
commentsVisible: false,
|
|
789
|
-
annotation: {
|
|
790
|
-
value: 'new',
|
|
791
|
-
type: 'brush',
|
|
792
|
-
active: false,
|
|
793
|
-
color: '#ff6c56',
|
|
794
|
-
redo: false,
|
|
795
|
-
undo: false
|
|
796
|
-
},
|
|
797
|
-
annotations: [],
|
|
798
|
-
isFullscreen: false,
|
|
799
|
-
HLSConfig: {
|
|
800
|
-
debug: true,
|
|
801
|
-
capLevelToPlayerSize: false,
|
|
802
|
-
maxBufferLength: 10,
|
|
803
|
-
maxMaxBufferLength: 600,
|
|
804
|
-
maxBufferSize: 30,
|
|
805
|
-
enableWebVTT: false,
|
|
806
|
-
enableCEA708Captions: false
|
|
807
|
-
},
|
|
808
|
-
SDBorderActive: true,
|
|
809
|
-
paused: true,
|
|
810
|
-
hasStarted: false,
|
|
811
|
-
muted: false,
|
|
812
|
-
audioTracksArr: [],
|
|
813
|
-
seekingTime: 0,
|
|
814
|
-
previewActive: false,
|
|
815
|
-
isActive: false
|
|
816
|
-
};
|
|
817
|
-
return _this;
|
|
818
|
-
}
|
|
819
|
-
_createClass(Player, [{
|
|
820
|
-
key: "onSegmentClick",
|
|
821
|
-
value: function onSegmentClick(start_time, end_time, seek) {
|
|
822
|
-
// this.actions.handleMarkerUpdate(start_time, end_time);
|
|
823
|
-
if (seek) {
|
|
824
|
-
this.actionClick({
|
|
825
|
-
action: 'pause'
|
|
826
|
-
});
|
|
827
|
-
} else {
|
|
828
|
-
this.actionClick({
|
|
829
|
-
action: 'play'
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
// this.actions.handleVideoRewind(false);
|
|
833
|
-
this.actionClick({
|
|
834
|
-
action: 'seek',
|
|
835
|
-
value: start_time
|
|
836
|
-
});
|
|
837
|
-
// this.actions.seek(start_time);
|
|
838
|
-
this.actionClick({
|
|
839
|
-
action: 'handle_video_preview',
|
|
840
|
-
value: true
|
|
841
|
-
});
|
|
842
|
-
// this.actions.handleVideoPreview(true);
|
|
843
|
-
}
|
|
844
|
-
}, {
|
|
845
|
-
key: "render",
|
|
846
|
-
value: function render() {
|
|
847
|
-
var _this2 = this;
|
|
848
|
-
var _this$props2 = this.props,
|
|
849
|
-
rightSection = _this$props2.rightSection,
|
|
850
|
-
title = _this$props2.videoDetails.title,
|
|
851
|
-
playerType = _this$props2.playerType,
|
|
852
|
-
controlType = _this$props2.controlType;
|
|
853
|
-
var _this$state5 = this.state,
|
|
854
|
-
playlistVisible = _this$state5.playlistVisible,
|
|
855
|
-
hasStarted = _this$state5.hasStarted;
|
|
856
|
-
var props = _objectSpread(_objectSpread(_objectSpread({}, this.props), this.state), {}, {
|
|
857
|
-
actionClick: this.actionClick
|
|
858
|
-
});
|
|
859
|
-
return /*#__PURE__*/_react["default"].createElement(PlayerBlock, {
|
|
860
|
-
ref: function ref(c) {
|
|
861
|
-
_this2.playerBlock = c;
|
|
862
|
-
}
|
|
863
|
-
}, /*#__PURE__*/_react["default"].createElement(PlayerContainer, _extends({
|
|
864
|
-
id: "player-container",
|
|
865
|
-
ref: function ref(playerContainer) {
|
|
866
|
-
_this2.playerContainer = playerContainer;
|
|
867
|
-
}
|
|
868
|
-
}, props, {
|
|
869
|
-
hasRightSection: !!rightSection,
|
|
870
|
-
playlistVisible: playlistVisible
|
|
871
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
872
|
-
className: "left-video-section",
|
|
873
|
-
ref: function ref(leftSectionRef) {
|
|
874
|
-
_this2.leftSectionRef = leftSectionRef;
|
|
875
|
-
}
|
|
876
|
-
}, /*#__PURE__*/_react["default"].createElement(_Header["default"], _extends({
|
|
877
|
-
id: "header-container",
|
|
878
|
-
title: title,
|
|
879
|
-
onBackPressed: function onBackPressed() {
|
|
880
|
-
return _this2.onBackPressed();
|
|
881
|
-
}
|
|
882
|
-
}, props)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
883
|
-
id: "media-controls-block"
|
|
884
|
-
}, /*#__PURE__*/_react["default"].createElement(_Video["default"], _extends({}, props, {
|
|
885
|
-
ref: function ref(mediaRef) {
|
|
886
|
-
_this2.mediaRef = mediaRef;
|
|
887
|
-
}
|
|
888
|
-
}))), /*#__PURE__*/_react["default"].createElement(_Shortcut["default"], _extends({}, props, {
|
|
889
|
-
player: this.mediaRef
|
|
890
|
-
})), playerType === 'default' && /*#__PURE__*/_react["default"].createElement(_ProgressControl["default"], _extends({
|
|
891
|
-
id: "progress-control",
|
|
892
|
-
ref: function ref(c) {
|
|
893
|
-
_this2._progressControl = c;
|
|
894
|
-
}
|
|
895
|
-
}, props, {
|
|
896
|
-
key: "progress-control"
|
|
897
|
-
})), /*#__PURE__*/_react["default"].createElement(_ControlBar["default"], props)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
898
|
-
id: "audio-meter-block",
|
|
899
|
-
className: "audio-meter-block ".concat(playerType),
|
|
900
|
-
ref: function ref(audioMeterBlock) {
|
|
901
|
-
_this2._audioMeterBlock = audioMeterBlock;
|
|
902
|
-
}
|
|
903
|
-
}, /*#__PURE__*/_react["default"].createElement(AudioMeterBlock, {
|
|
904
|
-
onClick: function onClick() {
|
|
905
|
-
_this2.meterBlockClick();
|
|
906
|
-
},
|
|
907
|
-
role: "presentation",
|
|
908
|
-
active: true
|
|
909
|
-
}, /*#__PURE__*/_react["default"].createElement(_AudioMeter["default"], _extends({
|
|
910
|
-
height: this.meterHeight,
|
|
911
|
-
hasStarted: hasStarted
|
|
912
|
-
}, this.props)))), rightSection ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
913
|
-
className: "right-video-section",
|
|
914
|
-
id: "right-section",
|
|
915
|
-
ref: function ref(rightSectionRef) {
|
|
916
|
-
_this2.rightSectionRef = rightSectionRef;
|
|
917
|
-
}
|
|
918
|
-
}, rightSection) : null), /*#__PURE__*/_react["default"].createElement("div", {
|
|
919
|
-
id: "comments-playlist"
|
|
920
|
-
}, controlType === 'advanced' ? /*#__PURE__*/_react["default"].createElement(_ProgressControl["default"], _extends({
|
|
921
|
-
id: "progress-control",
|
|
922
|
-
ref: function ref(c) {
|
|
923
|
-
_this2._progressControl = c;
|
|
924
|
-
}
|
|
925
|
-
}, props, {
|
|
926
|
-
key: "progress-control"
|
|
927
|
-
})) : /*#__PURE__*/_react["default"].createElement(_playlist["default"], _extends({
|
|
928
|
-
id: "playlist",
|
|
929
|
-
ref: function ref(c) {
|
|
930
|
-
_this2.playlist = c;
|
|
931
|
-
},
|
|
932
|
-
key: "playlist",
|
|
933
|
-
order: 5
|
|
934
|
-
}, props))));
|
|
935
|
-
}
|
|
936
|
-
}]);
|
|
937
|
-
return Player;
|
|
938
|
-
}(_react.Component);
|
|
939
|
-
exports["default"] = Player;
|
|
940
|
-
Player.contextTypes = {
|
|
941
|
-
store: _propTypes.PropTypes.instanceOf(Object)
|
|
942
|
-
};
|
|
943
|
-
Player.propTypes = propTypes;
|
|
944
|
-
Player.defaultProps = defaultProps;
|
|
945
|
-
Player.displayName = 'Player';
|