@desynova-digital/player 3.9.6 → 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 +266 -326
- 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/AudioMeter.js
CHANGED
|
@@ -1,75 +1,56 @@
|
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
24
|
-
|
|
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 _components = require("@desynova-digital/components");
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
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."); }
|
|
18
|
+
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); }
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
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; }
|
|
25
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
23
|
+
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); } }
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
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); }
|
|
27
|
+
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); }
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
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); }; }
|
|
30
|
+
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); }
|
|
31
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
32
|
+
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; } }
|
|
33
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
34
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
31
35
|
var propTypes = {
|
|
32
36
|
height: _propTypes.PropTypes.number,
|
|
33
37
|
player: _propTypes.PropTypes.instanceOf(Object)
|
|
34
38
|
};
|
|
35
|
-
|
|
36
39
|
var defaultProps = {
|
|
37
40
|
height: 0
|
|
38
41
|
};
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var MeterBlock = (0, _styledComponents2.default)('div').withConfig({
|
|
46
|
-
displayName: 'AudioMeter__MeterBlock',
|
|
47
|
-
componentId: 'sc-5gt1e5-1'
|
|
48
|
-
})(['width:100%;height:100%;position:absolute;left:0;top:0;display:flex;justify-content:space-evenly;align-items:center;.track-block{position:relative;width:15px;height:100%;overflow:visible;&.left-track,&.right-track{&:after{position:absolute;color:#aaaaaa;bottom:-12px;font-size:10px;left:50%;transform:translateX(-50%);font-family:SFUIText-Regular;}}&.left-track:after{content:\'L\';}&.right-track:after{content:\'R\';}}']);
|
|
49
|
-
|
|
50
|
-
var ColorMeter = (0, _styledComponents2.default)('div').withConfig({
|
|
51
|
-
displayName: 'AudioMeter__ColorMeter',
|
|
52
|
-
componentId: 'sc-5gt1e5-2'
|
|
53
|
-
})(['width:100%;height:100%;background:linear-gradient( to top,#00c8e7,#00e6b9 57%,#ff8d29 83%,#f6462c );position:absolute;left:0;top:0;z-index:1;.stack-block{height:2px;margin-bottom:3px;background:#000000;}']);
|
|
54
|
-
|
|
55
|
-
var BlackMeter = (0, _styledComponents2.default)('div').withConfig({
|
|
56
|
-
displayName: 'AudioMeter__BlackMeter',
|
|
57
|
-
componentId: 'sc-5gt1e5-3'
|
|
58
|
-
})(['width:100%;background:#000000;position:absolute;left:0;top:0;z-index:1;height:100%;transition:all 0.25s ease-in-out;-moz-transition:all 0.25s ease-in-out;-webkit-transition:all 0.25s ease-in-out;-ms-transition:all 0.25s ease-in-out;-o-transition:all 0.25s ease-in-out;.stack-block{height:2px;margin-bottom:3px;background:#304153;}']);
|
|
59
|
-
|
|
60
|
-
var AudioMute = (0, _styledComponents2.default)('div').withConfig({
|
|
61
|
-
displayName: 'AudioMeter__AudioMute',
|
|
62
|
-
componentId: 'sc-5gt1e5-4'
|
|
63
|
-
})(['position:absolute;top:-20px;left:50%;transform:translateX(-50%);color:#aaaaaa;cursor:pointer;']);
|
|
64
|
-
|
|
65
|
-
var AudioMeter = function (_Component) {
|
|
42
|
+
var RangeBlock = (0, _styledComponents["default"])('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n right: -12px;\n height: 100%;\n overflow: hidden;\n .range {\n color: #aaaaaa;\n font-family: SFUIText-Medium;\n text-align: right;\n font-size: 8px;\n box-sizing: border-box;\n }\n"])));
|
|
43
|
+
var MeterBlock = (0, _styledComponents["default"])('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n .track-block {\n position: relative;\n width: 15px;\n height: 100%;\n overflow: visible;\n &.left-track,\n &.right-track {\n &:after {\n position: absolute;\n color: #aaaaaa;\n bottom: -12px;\n font-size: 10px;\n left: 50%;\n transform: translateX(-50%);\n font-family: SFUIText-Regular;\n }\n }\n &.left-track:after {\n content: 'L';\n }\n &.right-track:after {\n content: 'R';\n }\n }\n"])));
|
|
44
|
+
var ColorMeter = (0, _styledComponents["default"])('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n background: linear-gradient(\n to top,\n #00c8e7,\n #00e6b9 57%,\n #ff8d29 83%,\n #f6462c\n );\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n .stack-block {\n height: 2px;\n margin-bottom: 3px;\n background: #000000;\n }\n"])));
|
|
45
|
+
var BlackMeter = (0, _styledComponents["default"])('div')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n background: #000000;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n height: 100%;\n transition: all 0.25s ease-in-out;\n -moz-transition: all 0.25s ease-in-out;\n -webkit-transition: all 0.25s ease-in-out;\n -ms-transition: all 0.25s ease-in-out;\n -o-transition: all 0.25s ease-in-out;\n .stack-block {\n height: 2px;\n margin-bottom: 3px;\n background: #304153;\n }\n"])));
|
|
46
|
+
var AudioMute = (0, _styledComponents["default"])('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n top: -20px;\n left: 50%;\n transform: translateX(-50%);\n color: #aaaaaa;\n cursor: pointer;\n"])));
|
|
47
|
+
var AudioMeter = /*#__PURE__*/function (_Component) {
|
|
66
48
|
_inherits(AudioMeter, _Component);
|
|
67
|
-
|
|
49
|
+
var _super = _createSuper(AudioMeter);
|
|
68
50
|
function AudioMeter(props, context) {
|
|
51
|
+
var _this;
|
|
69
52
|
_classCallCheck(this, AudioMeter);
|
|
70
|
-
|
|
71
|
-
var _this = _possibleConstructorReturn(this, (AudioMeter.__proto__ || Object.getPrototypeOf(AudioMeter)).call(this, props, context));
|
|
72
|
-
|
|
53
|
+
_this = _super.call(this, props, context);
|
|
73
54
|
_this.state = {
|
|
74
55
|
stacksArr: [],
|
|
75
56
|
rangeArray: [],
|
|
@@ -82,30 +63,28 @@ var AudioMeter = function (_Component) {
|
|
|
82
63
|
_this.dbRange = -48;
|
|
83
64
|
_this.channelCount = 2;
|
|
84
65
|
_this.maskSizes = ['100%', '100%'];
|
|
85
|
-
_this.handleClick = _this.handleClick.bind(_this);
|
|
86
|
-
_this.getNoOfStacks = _this.getNoOfStacks.bind(_this);
|
|
87
|
-
_this.maskSize = _this.maskSize.bind(_this);
|
|
88
|
-
_this.updateMeter = _this.updateMeter.bind(_this);
|
|
89
|
-
_this.paintMeter = _this.paintMeter.bind(_this);
|
|
66
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
67
|
+
_this.getNoOfStacks = _this.getNoOfStacks.bind(_assertThisInitialized(_this));
|
|
68
|
+
_this.maskSize = _this.maskSize.bind(_assertThisInitialized(_this));
|
|
69
|
+
_this.updateMeter = _this.updateMeter.bind(_assertThisInitialized(_this));
|
|
70
|
+
_this.paintMeter = _this.paintMeter.bind(_assertThisInitialized(_this));
|
|
90
71
|
return _this;
|
|
91
72
|
}
|
|
92
|
-
|
|
93
73
|
_createClass(AudioMeter, [{
|
|
94
|
-
key:
|
|
74
|
+
key: "componentDidMount",
|
|
95
75
|
value: function componentDidMount() {
|
|
96
76
|
var player = this.props.player;
|
|
97
|
-
|
|
98
77
|
if (player.hasStarted) {
|
|
99
78
|
this.initializeMeter();
|
|
100
79
|
}
|
|
101
80
|
}
|
|
102
81
|
}, {
|
|
103
|
-
key:
|
|
82
|
+
key: "componentWillUnmount",
|
|
104
83
|
value: function componentWillUnmount() {
|
|
105
84
|
this.disconnectMeter();
|
|
106
85
|
}
|
|
107
86
|
}, {
|
|
108
|
-
key:
|
|
87
|
+
key: "disconnectMeter",
|
|
109
88
|
value: function disconnectMeter() {
|
|
110
89
|
if (this.sourceNode && this.meterNode) {
|
|
111
90
|
this.sourceNode.disconnect(this.meterNode);
|
|
@@ -113,21 +92,20 @@ var AudioMeter = function (_Component) {
|
|
|
113
92
|
}
|
|
114
93
|
}
|
|
115
94
|
}, {
|
|
116
|
-
key:
|
|
95
|
+
key: "getBaseLog",
|
|
117
96
|
value: function getBaseLog(x, y) {
|
|
118
97
|
return Math.log(y) / Math.log(x);
|
|
119
98
|
}
|
|
120
99
|
}, {
|
|
121
|
-
key:
|
|
100
|
+
key: "getNoOfStacks",
|
|
122
101
|
value: function getNoOfStacks() {
|
|
123
102
|
if (this._meterBlockRef) {
|
|
124
103
|
var stacksArr = this.state.stacksArr;
|
|
125
|
-
|
|
126
104
|
var stackHeight = 5;
|
|
127
105
|
var height = this._meterBlockRef.offsetHeight;
|
|
128
106
|
if (height) {
|
|
129
107
|
var stacksLength = Math.round(height / stackHeight);
|
|
130
|
-
var stackArr =
|
|
108
|
+
var stackArr = _toConsumableArray(Array(stacksLength)).map(function (x, i) {
|
|
131
109
|
return i;
|
|
132
110
|
});
|
|
133
111
|
var numOfSteps = Math.round(height / 30);
|
|
@@ -151,7 +129,7 @@ var AudioMeter = function (_Component) {
|
|
|
151
129
|
}
|
|
152
130
|
}
|
|
153
131
|
}, {
|
|
154
|
-
key:
|
|
132
|
+
key: "createMeterNode",
|
|
155
133
|
value: function createMeterNode() {
|
|
156
134
|
var c = this.sourceNode.channelCount;
|
|
157
135
|
this.meterNode = this.audioCtx.createScriptProcessor(2048, c, c);
|
|
@@ -160,13 +138,13 @@ var AudioMeter = function (_Component) {
|
|
|
160
138
|
return this.meterNode;
|
|
161
139
|
}
|
|
162
140
|
}, {
|
|
163
|
-
key:
|
|
141
|
+
key: "createMeter",
|
|
164
142
|
value: function createMeter(meterNode) {
|
|
165
143
|
meterNode.onaudioprocess = this.updateMeter;
|
|
166
144
|
this.paintMeter();
|
|
167
145
|
}
|
|
168
146
|
}, {
|
|
169
|
-
key:
|
|
147
|
+
key: "updateMeter",
|
|
170
148
|
value: function updateMeter(audioProcessingEvent) {
|
|
171
149
|
var inputBuffer = audioProcessingEvent.inputBuffer;
|
|
172
150
|
var i = 0;
|
|
@@ -189,7 +167,7 @@ var AudioMeter = function (_Component) {
|
|
|
189
167
|
}
|
|
190
168
|
}
|
|
191
169
|
}, {
|
|
192
|
-
key:
|
|
170
|
+
key: "maskSize",
|
|
193
171
|
value: function maskSize(floatVal) {
|
|
194
172
|
var returnVal = Math.floor(this.dbFromFloat(floatVal) * 100 / this.dbRange);
|
|
195
173
|
if (returnVal > 100) {
|
|
@@ -199,19 +177,18 @@ var AudioMeter = function (_Component) {
|
|
|
199
177
|
}
|
|
200
178
|
}
|
|
201
179
|
}, {
|
|
202
|
-
key:
|
|
180
|
+
key: "dbFromFloat",
|
|
203
181
|
value: function dbFromFloat(floatVal) {
|
|
204
182
|
return this.getBaseLog(10, floatVal) * 20;
|
|
205
183
|
}
|
|
206
184
|
}, {
|
|
207
|
-
key:
|
|
185
|
+
key: "paintMeter",
|
|
208
186
|
value: function paintMeter() {
|
|
209
187
|
for (var i = 0; i < this.channelCount; i++) {
|
|
210
188
|
var audioPan = this.state.audioPan;
|
|
211
|
-
|
|
212
189
|
var leftPan = audioPan.left;
|
|
213
190
|
var rightPan = audioPan.right;
|
|
214
|
-
var elem = document.getElementById(
|
|
191
|
+
var elem = document.getElementById("channel-".concat(i));
|
|
215
192
|
if (elem) {
|
|
216
193
|
if (i === 0 && !leftPan) {
|
|
217
194
|
elem.style.height = '100%';
|
|
@@ -225,10 +202,9 @@ var AudioMeter = function (_Component) {
|
|
|
225
202
|
window.requestAnimationFrame(this.paintMeter);
|
|
226
203
|
}
|
|
227
204
|
}, {
|
|
228
|
-
key:
|
|
205
|
+
key: "muteAudio",
|
|
229
206
|
value: function muteAudio(position) {
|
|
230
207
|
var audioPan = this.state.audioPan;
|
|
231
|
-
|
|
232
208
|
var leftPan = audioPan.left;
|
|
233
209
|
var rightPan = audioPan.right;
|
|
234
210
|
switch (position) {
|
|
@@ -263,7 +239,7 @@ var AudioMeter = function (_Component) {
|
|
|
263
239
|
});
|
|
264
240
|
}
|
|
265
241
|
}, {
|
|
266
|
-
key:
|
|
242
|
+
key: "initializeMeter",
|
|
267
243
|
value: function initializeMeter() {
|
|
268
244
|
this.getNoOfStacks();
|
|
269
245
|
var myVideo = document.querySelector('video');
|
|
@@ -273,7 +249,6 @@ var AudioMeter = function (_Component) {
|
|
|
273
249
|
this.gainR = this.audioCtx.createGain();
|
|
274
250
|
this.merger = this.audioCtx.createChannelMerger(2);
|
|
275
251
|
var splitter = this.audioCtx.createChannelSplitter(2);
|
|
276
|
-
|
|
277
252
|
this.sourceNode = this.sourceNode || this.audioCtx.createMediaElementSource(myVideo);
|
|
278
253
|
this.sourceNode.connect(splitter, 0, 0);
|
|
279
254
|
|
|
@@ -292,12 +267,11 @@ var AudioMeter = function (_Component) {
|
|
|
292
267
|
this.createMeter(meterNode);
|
|
293
268
|
}
|
|
294
269
|
}, {
|
|
295
|
-
key:
|
|
270
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
296
271
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
272
|
+
var _this$props = this.props,
|
|
273
|
+
height = _this$props.height,
|
|
274
|
+
player = _this$props.player;
|
|
301
275
|
if (height && height !== newProps.height) {
|
|
302
276
|
this.getNoOfStacks();
|
|
303
277
|
}
|
|
@@ -306,109 +280,91 @@ var AudioMeter = function (_Component) {
|
|
|
306
280
|
}
|
|
307
281
|
}
|
|
308
282
|
}, {
|
|
309
|
-
key:
|
|
283
|
+
key: "handleClick",
|
|
310
284
|
value: function handleClick() {}
|
|
311
285
|
}, {
|
|
312
|
-
key:
|
|
286
|
+
key: "render",
|
|
313
287
|
value: function render() {
|
|
314
288
|
var _this2 = this;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
_react2.default.createElement(
|
|
326
|
-
RangeBlock,
|
|
327
|
-
null,
|
|
328
|
-
rangeArray.map(function (range) {
|
|
329
|
-
return _react2.default.createElement(
|
|
330
|
-
'div',
|
|
331
|
-
{
|
|
332
|
-
key: 'range' + range,
|
|
333
|
-
style: { height: unitBlockHeight + 'px' },
|
|
334
|
-
className: 'range'
|
|
335
|
-
},
|
|
336
|
-
range
|
|
337
|
-
);
|
|
338
|
-
})
|
|
339
|
-
),
|
|
340
|
-
_react2.default.createElement(
|
|
341
|
-
MeterBlock,
|
|
342
|
-
{
|
|
343
|
-
ref: function ref(meterBlockRef) {
|
|
344
|
-
_this2._meterBlockRef = meterBlockRef;
|
|
345
|
-
}
|
|
289
|
+
var _this$state = this.state,
|
|
290
|
+
stacksArr = _this$state.stacksArr,
|
|
291
|
+
rangeArray = _this$state.rangeArray,
|
|
292
|
+
unitBlockHeight = _this$state.unitBlockHeight,
|
|
293
|
+
audioPan = _this$state.audioPan;
|
|
294
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(RangeBlock, null, rangeArray.map(function (range) {
|
|
295
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
296
|
+
key: 'range' + range,
|
|
297
|
+
style: {
|
|
298
|
+
height: unitBlockHeight + 'px'
|
|
346
299
|
},
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
300
|
+
className: "range"
|
|
301
|
+
}, range);
|
|
302
|
+
})), /*#__PURE__*/_react["default"].createElement(MeterBlock, {
|
|
303
|
+
ref: function ref(meterBlockRef) {
|
|
304
|
+
_this2._meterBlockRef = meterBlockRef;
|
|
305
|
+
}
|
|
306
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
307
|
+
className: "track-block left-track"
|
|
308
|
+
}, /*#__PURE__*/_react["default"].createElement(ColorMeter, null, stacksArr.map(function (num) {
|
|
309
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
310
|
+
className: "stack-block",
|
|
311
|
+
key: num
|
|
312
|
+
});
|
|
313
|
+
})), /*#__PURE__*/_react["default"].createElement(BlackMeter, {
|
|
314
|
+
id: "channel-0"
|
|
315
|
+
}, stacksArr.map(function (num) {
|
|
316
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
317
|
+
className: "stack-block",
|
|
318
|
+
key: num
|
|
319
|
+
});
|
|
320
|
+
})), /*#__PURE__*/_react["default"].createElement(AudioMute, {
|
|
321
|
+
onClick: function onClick() {
|
|
322
|
+
_this2.muteAudio('left');
|
|
323
|
+
}
|
|
324
|
+
}, audioPan.left ? /*#__PURE__*/_react["default"].createElement(_components.Icon, {
|
|
325
|
+
name: "volume",
|
|
326
|
+
width: 14,
|
|
327
|
+
height: 14,
|
|
328
|
+
color: "#aaaaaa"
|
|
329
|
+
}) : /*#__PURE__*/_react["default"].createElement(_components.Icon, {
|
|
330
|
+
name: "mute",
|
|
331
|
+
width: 14,
|
|
332
|
+
height: 14,
|
|
333
|
+
color: "#aaaaaa"
|
|
334
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
335
|
+
className: "track-block right-track"
|
|
336
|
+
}, /*#__PURE__*/_react["default"].createElement(ColorMeter, null, stacksArr.map(function (num) {
|
|
337
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
338
|
+
className: "stack-block",
|
|
339
|
+
key: num
|
|
340
|
+
});
|
|
341
|
+
})), /*#__PURE__*/_react["default"].createElement(BlackMeter, {
|
|
342
|
+
id: "channel-1"
|
|
343
|
+
}, stacksArr.map(function (num) {
|
|
344
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
345
|
+
className: "stack-block",
|
|
346
|
+
key: num
|
|
347
|
+
});
|
|
348
|
+
})), /*#__PURE__*/_react["default"].createElement(AudioMute, {
|
|
349
|
+
onClick: function onClick() {
|
|
350
|
+
_this2.muteAudio('right');
|
|
351
|
+
}
|
|
352
|
+
}, audioPan.right ? /*#__PURE__*/_react["default"].createElement(_components.Icon, {
|
|
353
|
+
name: "volume",
|
|
354
|
+
width: 14,
|
|
355
|
+
height: 14,
|
|
356
|
+
color: "#aaaaaa"
|
|
357
|
+
}) : /*#__PURE__*/_react["default"].createElement(_components.Icon, {
|
|
358
|
+
name: "mute",
|
|
359
|
+
width: 14,
|
|
360
|
+
height: 14,
|
|
361
|
+
color: "#aaaaaa"
|
|
362
|
+
})))));
|
|
403
363
|
}
|
|
404
364
|
}]);
|
|
405
|
-
|
|
406
365
|
return AudioMeter;
|
|
407
366
|
}(_react.Component);
|
|
408
|
-
|
|
409
|
-
exports.default = AudioMeter;
|
|
410
|
-
|
|
411
|
-
|
|
367
|
+
exports["default"] = AudioMeter;
|
|
412
368
|
AudioMeter.propTypes = propTypes;
|
|
413
369
|
AudioMeter.defaultProps = defaultProps;
|
|
414
370
|
AudioMeter.displayName = 'AudioMeter';
|