@lls/lls-audio 0.0.11 → 0.0.13
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/package.json +1 -1
- package/player/CustomWave.js +4 -4
- package/player/Play.js +2 -2
- package/stories/player.js +55 -3
package/package.json
CHANGED
package/player/CustomWave.js
CHANGED
|
@@ -97,6 +97,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
97
97
|
|
|
98
98
|
// Duration and step calculation
|
|
99
99
|
var maxDuration = totalTime || waveform.duration;
|
|
100
|
+
|
|
100
101
|
var levelStep = Math.ceil(waveform.max.length / maxWidth) * RESOLUTION;
|
|
101
102
|
|
|
102
103
|
// Range positions
|
|
@@ -122,14 +123,13 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
122
123
|
highestAverage = _maxLevelChunks$reduc.highestAverage,
|
|
123
124
|
averages = _maxLevelChunks$reduc.averages;
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
var ratio = maxWidth / maxLevelChunks.length;
|
|
127
127
|
|
|
128
|
+
// Clear canvas and draw one bar for each level
|
|
128
129
|
_this2.ctx.clearRect(0, 0, maxWidth, maxHeight);
|
|
129
130
|
averages.forEach(function (average, i) {
|
|
130
|
-
var x = i *
|
|
131
|
+
var x = i * ratio;
|
|
131
132
|
var h = average * (maxHeight / highestAverage);
|
|
132
|
-
|
|
133
133
|
var color = x >= startX && x <= endX ? colorScheme[1] : colorScheme[0];
|
|
134
134
|
|
|
135
135
|
_this2.drawLevel({
|
package/player/Play.js
CHANGED
|
@@ -24,7 +24,7 @@ var styles = _noImportant.StyleSheet.create({
|
|
|
24
24
|
left: {
|
|
25
25
|
'height': '100%',
|
|
26
26
|
'float': 'left',
|
|
27
|
-
'background-color': '
|
|
27
|
+
'background-color': '#e51400',
|
|
28
28
|
'width': '36%',
|
|
29
29
|
'transition': 'all 0.25s ease',
|
|
30
30
|
'overflow': 'hidden'
|
|
@@ -51,7 +51,7 @@ var styles = _noImportant.StyleSheet.create({
|
|
|
51
51
|
'height': '100%',
|
|
52
52
|
'float': 'right',
|
|
53
53
|
'width': '36%',
|
|
54
|
-
'background-color': '
|
|
54
|
+
'background-color': '#e51400',
|
|
55
55
|
'transition': 'all 0.25s ease'
|
|
56
56
|
}
|
|
57
57
|
|
package/stories/player.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
7
9
|
var _react = require('react');
|
|
8
10
|
|
|
9
11
|
var _react2 = _interopRequireDefault(_react);
|
|
@@ -14,8 +16,58 @@ var _player2 = _interopRequireDefault(_player);
|
|
|
14
16
|
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
19
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
+
|
|
21
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
22
|
+
|
|
23
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
24
|
+
|
|
25
|
+
var PlayerExample = function (_Component) {
|
|
26
|
+
_inherits(PlayerExample, _Component);
|
|
27
|
+
|
|
28
|
+
function PlayerExample(props) {
|
|
29
|
+
_classCallCheck(this, PlayerExample);
|
|
30
|
+
|
|
31
|
+
var _this = _possibleConstructorReturn(this, (PlayerExample.__proto__ || Object.getPrototypeOf(PlayerExample)).call(this, props));
|
|
32
|
+
|
|
33
|
+
_this.state = {
|
|
34
|
+
url: 'http://lls-media-public.s3.amazonaws.com/upload/LeLivreScolaire/p15vcjbl4lvpl9l7g8ov8ammh1.mp3'
|
|
35
|
+
};
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_createClass(PlayerExample, [{
|
|
40
|
+
key: 'render',
|
|
41
|
+
value: function render() {
|
|
42
|
+
var _this2 = this;
|
|
43
|
+
|
|
44
|
+
return _react2.default.createElement(
|
|
45
|
+
'div',
|
|
46
|
+
null,
|
|
47
|
+
_react2.default.createElement('input', { style: { width: 'calc(100% - 20px)', padding: 10 }, onChange: function onChange(_ref) {
|
|
48
|
+
var value = _ref.target.value;
|
|
49
|
+
return _this2.setState({ url: value });
|
|
50
|
+
}, value: this.state.url }),
|
|
51
|
+
_react2.default.createElement(
|
|
52
|
+
'ul',
|
|
53
|
+
null,
|
|
54
|
+
_react2.default.createElement(
|
|
55
|
+
'li',
|
|
56
|
+
null,
|
|
57
|
+
'http://lls-media-public.s3-eu-west-1.amazonaws.com/anglais-6e/meet-the-campbells/new-friends/start..mp3'
|
|
58
|
+
),
|
|
59
|
+
_react2.default.createElement(
|
|
60
|
+
'li',
|
|
61
|
+
null,
|
|
62
|
+
'http://lls-media-public.s3.amazonaws.com/upload/LeLivreScolaire/p15vcjbl4lvpl9l7g8ov8ammh1.mp3'
|
|
63
|
+
)
|
|
64
|
+
),
|
|
65
|
+
_react2.default.createElement(_player2.default, { url: this.state.url })
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}]);
|
|
69
|
+
|
|
70
|
+
return PlayerExample;
|
|
71
|
+
}(_react.Component);
|
|
20
72
|
|
|
21
73
|
exports.default = PlayerExample;
|