@lls/lls-audio 0.0.3

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.
@@ -0,0 +1,158 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+
19
+ var RESOLUTION = 1;
20
+ var colorScheme = ['#888', '#e51400'];
21
+
22
+ var chunks = function chunks(arr, chunkSize) {
23
+ return arr.map(function (e, i) {
24
+ return i % chunkSize === 0 ? arr.slice(i, i + chunkSize) : null;
25
+ }).filter(function (e) {
26
+ return e;
27
+ });
28
+ };
29
+
30
+ var Waveform = function (_Component) {
31
+ _inherits(Waveform, _Component);
32
+
33
+ function Waveform(props) {
34
+ _classCallCheck(this, Waveform);
35
+
36
+ //this.loopIsEnabled = false
37
+ var _this = _possibleConstructorReturn(this, (Waveform.__proto__ || Object.getPrototypeOf(Waveform)).call(this, props));
38
+
39
+ _initialiseProps.call(_this);
40
+
41
+ _this.ctx = null;
42
+ return _this;
43
+ }
44
+
45
+ return Waveform;
46
+ }(_react.Component);
47
+
48
+ var _initialiseProps = function _initialiseProps() {
49
+ var _this2 = this;
50
+
51
+ this.componentDidMount = function () {
52
+ var waveform = _this2.props.waveform;
53
+
54
+ _this2.initialise(_this2.props);
55
+ };
56
+
57
+ this.componentWillReceiveProps = function (nextProps) {
58
+ _this2.initialise(nextProps);
59
+ };
60
+
61
+ this.initialise = function (props) {
62
+ var width = props.width,
63
+ height = props.height,
64
+ waveform = props.waveform,
65
+ totalTime = props.totalTime;
66
+
67
+ if (!waveform) return;
68
+ _this2.fixCanvasScale(width, height);
69
+ _this2.drawLevels(props);
70
+ };
71
+
72
+ this.fixCanvasScale = function (width, height) {
73
+ var canvas = _this2.refs.canvas;
74
+ if (!_this2.ctx) _this2.ctx = canvas.getContext('2d');
75
+
76
+ var devicePixelRatio = window.devicePixelRatio || 1;
77
+ var backingStoreRatio = _this2.ctx.webkitBackingStorePixelRatio || _this2.ctx.backingStorePixelRatio || 1;
78
+ var canvasRatio = devicePixelRatio / backingStoreRatio;
79
+ var scaledWidth = width * canvasRatio;
80
+ var scaledHeight = height * canvasRatio;
81
+
82
+ canvas.width = scaledWidth;
83
+ canvas.height = scaledHeight;
84
+ _this2.ctx.scale(canvasRatio, canvasRatio);
85
+ };
86
+
87
+ this.drawLevels = function (props) {
88
+ var height = props.height,
89
+ totalTime = props.totalTime,
90
+ waveform = props.waveform,
91
+ range = props.range,
92
+ currentTime = props.currentTime;
93
+ var pixels_per_second = waveform.pixels_per_second;
94
+
95
+ var maxWidth = _this2.refs.canvas.width;
96
+ var maxHeight = _this2.refs.canvas.height;
97
+
98
+ // Duration and step calculation
99
+ var maxDuration = totalTime || waveform.duration;
100
+ var levelStep = maxWidth / maxDuration;
101
+
102
+ // Range positions
103
+ //@todo: this range stuff should not be here. Waveform should just be passed an array of colors and ranges
104
+ var startX = range ? range.startTime / maxDuration * maxWidth : 0;
105
+ var endX = range ? range.endTime / maxDuration * maxWidth : maxDuration;
106
+
107
+ // Split data into chunks per level
108
+ var maxLevelChunks = chunks(waveform.max, Math.floor(pixels_per_second));
109
+
110
+ // Calculate average for each level + highest average
111
+
112
+ var _maxLevelChunks$reduc = maxLevelChunks.reduce(function (memo, levelData) {
113
+ var average = levelData.reduce(function (memo, data) {
114
+ return memo + data;
115
+ }, 0) / levelData.length;
116
+ if (average > memo.highestAverage) {
117
+ memo.highestAverage = average;
118
+ }
119
+ memo.averages.push(average);
120
+ return memo;
121
+ }, { highestAverage: 0, averages: [] }),
122
+ highestAverage = _maxLevelChunks$reduc.highestAverage,
123
+ averages = _maxLevelChunks$reduc.averages;
124
+
125
+ // Clear canvas and draw one bar for each level
126
+
127
+
128
+ _this2.ctx.clearRect(0, 0, maxWidth, maxHeight);
129
+ averages.forEach(function (average, i) {
130
+ var x = i * levelStep;
131
+ var h = average * (maxHeight / highestAverage);
132
+
133
+ var color = x >= startX && x <= endX ? colorScheme[1] : colorScheme[0];
134
+
135
+ _this2.drawLevel({
136
+ x: x,
137
+ y: maxHeight - h,
138
+ w: 1,
139
+ h: h,
140
+ color: color
141
+ });
142
+ });
143
+ };
144
+
145
+ this.drawLevel = function (level) {
146
+ _this2.ctx.fillStyle = '' + level.color;
147
+ _this2.ctx.fillRect(level.x, level.y, level.w, level.h);
148
+ };
149
+
150
+ this.render = function () {
151
+ return _react2.default.createElement('canvas', {
152
+ ref: 'canvas',
153
+ className: '' + _this2.props.className,
154
+ style: { width: _this2.props.width, height: _this2.props.height, position: 'relative', top: 9 } });
155
+ };
156
+ };
157
+
158
+ exports.default = Waveform;
@@ -0,0 +1,98 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _aphrodite = require('aphrodite');
12
+
13
+ var _FontIcon = require('material-ui/FontIcon');
14
+
15
+ var _FontIcon2 = _interopRequireDefault(_FontIcon);
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ var styles = _aphrodite.StyleSheet.create({
20
+ speed_menu_items: {
21
+ height: '300%',
22
+ position: 'relative',
23
+ bottom: '75%',
24
+ overflow: 'hidden',
25
+ backgroundColor: '#FFF',
26
+ border: '1px solid #E5E5E5',
27
+ transition: 'all 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28)',
28
+ ':hover': {
29
+ bottom: '150%',
30
+ overflow: 'visible'
31
+ }
32
+ },
33
+ speed_menu_item: {
34
+ padding: '28px 10px 0px 13px',
35
+ boxSizing: 'border-box'
36
+ },
37
+ speed_menu_low: {
38
+ bottom: '150%'
39
+ },
40
+ speed_menu_fast: {
41
+ bottom: '1%'
42
+ }
43
+ });
44
+
45
+ var getMenuPosition = function getMenuPosition(speed) {
46
+ switch (speed) {
47
+ case 1.25:
48
+ return 'speed_menu_fast';
49
+ case 0.75:
50
+ return 'speed_menu_low';
51
+ default:
52
+ return '';
53
+ }
54
+ };
55
+
56
+ var Speed = function Speed(_ref) {
57
+ var speed = _ref.speed,
58
+ onSpeedChange = _ref.onSpeedChange;
59
+ return _react2.default.createElement(
60
+ 'div',
61
+ { className: 'Speed_menu_items ' + (0, _aphrodite.css)(styles.speed_menu_items) + ' ' + (0, _aphrodite.css)(styles[getMenuPosition(speed)]) },
62
+ _react2.default.createElement(
63
+ 'div',
64
+ { className: 'Speed_menu_item ' + (0, _aphrodite.css)(styles.speed_menu_item), onClick: function onClick() {
65
+ return onSpeedChange(1.25);
66
+ } },
67
+ _react2.default.createElement(
68
+ _FontIcon2.default,
69
+ { style: { color: speed === 1.25 ? '#a20025' : '' }, className: 'material-icons' },
70
+ 'exposure_plus_1'
71
+ )
72
+ ),
73
+ _react2.default.createElement(
74
+ 'div',
75
+ { className: 'Speed_menu_item ' + (0, _aphrodite.css)(styles.speed_menu_item), onClick: function onClick() {
76
+ return onSpeedChange(1);
77
+ } },
78
+ _react2.default.createElement(
79
+ _FontIcon2.default,
80
+ { style: { color: speed === 1 ? '#a20025' : '' }, className: 'material-icons' },
81
+ 'exposure_zero'
82
+ )
83
+ ),
84
+ _react2.default.createElement(
85
+ 'div',
86
+ { className: 'Speed_menu_item ' + (0, _aphrodite.css)(styles.speed_menu_item), onClick: function onClick() {
87
+ return onSpeedChange(0.75);
88
+ } },
89
+ _react2.default.createElement(
90
+ _FontIcon2.default,
91
+ { style: { color: speed === 0.75 ? '#a20025' : '' }, className: 'material-icons' },
92
+ 'exposure_neg_1'
93
+ )
94
+ )
95
+ );
96
+ };
97
+
98
+ exports.default = Speed;
package/player/Wave.js ADDED
@@ -0,0 +1,173 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _waveform = require('../common/waveform');
12
+
13
+ var _waveform2 = _interopRequireDefault(_waveform);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+
19
+ 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; }
20
+
21
+ 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; }
22
+
23
+ // soundcloud waveform
24
+
25
+ var RESOLUTION = 1;
26
+ var colorScheme = ['#888', '#e51400'];
27
+
28
+ var interpolateHeight = function interpolateHeight(totalHeight) {
29
+ var amplitude = 256;
30
+ return function (size) {
31
+ return totalHeight - (size + 128) * totalHeight / amplitude;
32
+ };
33
+ };
34
+
35
+ var chunks = function chunks(arr, chunkSize) {
36
+ return arr.map(function (e, i) {
37
+ return i % chunkSize === 0 ? arr.slice(i, i + chunkSize) : null;
38
+ }).filter(function (e) {
39
+ return e;
40
+ });
41
+ };
42
+
43
+ var Wave = function (_Component) {
44
+ _inherits(Wave, _Component);
45
+
46
+ function Wave(props) {
47
+ _classCallCheck(this, Wave);
48
+
49
+ //this.loopIsEnabled = false
50
+ var _this = _possibleConstructorReturn(this, (Wave.__proto__ || Object.getPrototypeOf(Wave)).call(this, props));
51
+
52
+ _initialiseProps.call(_this);
53
+
54
+ _this.ctx = null;
55
+ _this.soundWave = null;
56
+ return _this;
57
+ }
58
+
59
+ /*
60
+ drawLevels = (props) => {
61
+ const { height, totalTime, waveform, range, currentTime } = props
62
+ const { pixels_per_second } = waveform
63
+ const maxWidth = this.refs.canvas.width
64
+ const maxHeight = this.refs.canvas.height
65
+ // Duration and step calculation
66
+ const maxDuration = totalTime || waveform.duration
67
+ const levelStep = maxWidth / maxDuration
68
+ // Range positions
69
+ //@todo: this range stuff should not be here. Waveform should just be passed an array of colors and ranges
70
+ const startX = range ? range.startTime / maxDuration * maxWidth : 0
71
+ const endX = range ? range.endTime / maxDuration * maxWidth : maxDuration
72
+ // Split data into chunks per level
73
+ const maxLevelChunks = chunks(waveform.max, Math.floor(pixels_per_second))
74
+ // Calculate average for each level + highest average
75
+ const { highestAverage, averages } = maxLevelChunks.reduce((memo, levelData) => {
76
+ const average = levelData.reduce((memo, data) => memo + data, 0 ) / levelData.length
77
+ if(average > memo.highestAverage) {
78
+ memo.highestAverage = average
79
+ }
80
+ memo.averages.push(average)
81
+ return memo
82
+ }, {highestAverage: 0, averages: []})
83
+ // Clear canvas and draw one bar for each level
84
+ this.ctx.clearRect(0, 0, maxWidth, maxHeight)
85
+ averages.forEach((average, i) => {
86
+ const x = i * levelStep
87
+ const h = average * (maxHeight / highestAverage )
88
+ const color = x >= startX && x <= endX
89
+ ? colorScheme[1]
90
+ : colorScheme[0]
91
+ this.drawLevel({
92
+ x: x,
93
+ y: maxHeight - h,
94
+ w: 1,
95
+ h: h,
96
+ color: color
97
+ })
98
+ })
99
+ }
100
+ drawLevel = (level) => {
101
+ this.ctx.fillStyle = `${level.color}`
102
+ this.ctx.fillRect(level.x, level.y, level.w, level.h)
103
+ }*/
104
+
105
+ return Wave;
106
+ }(_react.Component);
107
+
108
+ var _initialiseProps = function _initialiseProps() {
109
+ var _this2 = this;
110
+
111
+ this.componentDidMount = function () {
112
+ var waveform = _this2.props.waveform;
113
+
114
+ _this2.initialise(_this2.props);
115
+ };
116
+
117
+ this.componentWillReceiveProps = function (nextProps) {
118
+ _this2.initialise(nextProps);
119
+ };
120
+
121
+ this.initialise = function (props) {
122
+ var width = props.width,
123
+ height = props.height,
124
+ waveform = props.waveform,
125
+ totalTime = props.totalTime;
126
+
127
+ if (!waveform) return;
128
+ _this2.drawLevels(props);
129
+ };
130
+
131
+ this.drawLevels = function (props) {
132
+ var waveFormData = props.waveform,
133
+ range = props.range;
134
+
135
+ var startX = 0; //range ? range.startTime / maxDuration * maxWidth : 0
136
+ var endX = 0; //range ? range.endTime / maxDuration * maxWidth : maxDuration
137
+
138
+ var maxValue = waveFormData.max.reduce(function (memo, val) {
139
+ if (val > memo) memo = val;
140
+ return memo;
141
+ }, 0);
142
+
143
+ var values = waveFormData.max.map(function (val) {
144
+ return val === 0 ? 0.01 : val / maxValue;
145
+ });
146
+
147
+ window.setTimeout(function () {
148
+ if (!_this2.soundWave) {
149
+ _this2.soundWave = new _waveform2.default({
150
+ container: document.getElementById('wave'),
151
+ data: values,
152
+ innerColor: function innerColor(x, y) {
153
+ return x >= startX && x <= endX ? colorScheme[1] : colorScheme[0];
154
+ }
155
+ });
156
+ } else {
157
+ _this2.soundWave.update({
158
+ data: values
159
+ });
160
+ }
161
+ }, 0); // yeah, sorry
162
+ };
163
+
164
+ this.render = function () {
165
+ return _react2.default.createElement('div', {
166
+ id: 'wave',
167
+ ref: 'wave',
168
+ className: '' + _this2.props.className,
169
+ style: { width: _this2.props.width, height: _this2.props.height, position: 'relative', top: 9 } });
170
+ };
171
+ };
172
+
173
+ exports.default = Wave;
@@ -0,0 +1,218 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8
+
9
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10
+
11
+ var _react = require('react');
12
+
13
+ var _react2 = _interopRequireDefault(_react);
14
+
15
+ var _Wave = require('../player/Wave');
16
+
17
+ var _Wave2 = _interopRequireDefault(_Wave);
18
+
19
+ var _audio = require('../utils/audio');
20
+
21
+ var _FontIcon = require('material-ui/FontIcon');
22
+
23
+ var _FontIcon2 = _interopRequireDefault(_FontIcon);
24
+
25
+ var _noImportant = require('aphrodite/no-important');
26
+
27
+ var _reactInputRange = require('react-input-range');
28
+
29
+ var _reactInputRange2 = _interopRequireDefault(_reactInputRange);
30
+
31
+ var _utils = require('./utils');
32
+
33
+ var _volumeClassNames = require('./styles/volumeClassNames');
34
+
35
+ var _volumeClassNames2 = _interopRequireDefault(_volumeClassNames);
36
+
37
+ var _timelineClassNames = require('./styles/timelineClassNames');
38
+
39
+ var _timelineClassNames2 = _interopRequireDefault(_timelineClassNames);
40
+
41
+ var _fallbackTimelineClassNames = require('./styles/fallbackTimelineClassNames');
42
+
43
+ var _fallbackTimelineClassNames2 = _interopRequireDefault(_fallbackTimelineClassNames);
44
+
45
+ var _styles = require('./styles/styles');
46
+
47
+ var _styles2 = _interopRequireDefault(_styles);
48
+
49
+ var _Audio = require('./Audio');
50
+
51
+ var _Audio2 = _interopRequireDefault(_Audio);
52
+
53
+ var _Speed = require('./Speed');
54
+
55
+ var _Speed2 = _interopRequireDefault(_Speed);
56
+
57
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
58
+
59
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
60
+
61
+ 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; }
62
+
63
+ 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; }
64
+
65
+ var styles = _noImportant.StyleSheet.create(_styles2.default);
66
+
67
+ var Player = function (_Component) {
68
+ _inherits(Player, _Component);
69
+
70
+ function Player() {
71
+ _classCallCheck(this, Player);
72
+
73
+ var _this = _possibleConstructorReturn(this, (Player.__proto__ || Object.getPrototypeOf(Player)).call(this));
74
+
75
+ _this.state = { waveform: false, loading: true, containerWidth: 0 };
76
+ _this.setContainerWidth = (0, _utils.debounce)(_this.setContainerWidth.bind(_this), 500);
77
+ _this.onKeyPress = _this.onKeyPress.bind(_this);
78
+ return _this;
79
+ }
80
+
81
+ _createClass(Player, [{
82
+ key: 'componentWillMount',
83
+ value: function componentWillMount() {
84
+ this.initialize(this.props);
85
+ }
86
+ }, {
87
+ key: 'componentDidMount',
88
+ value: function componentDidMount() {
89
+ var _this2 = this;
90
+
91
+ setTimeout(function () {
92
+ return _this2.setContainerWidth();
93
+ }, 0);
94
+ window.addEventListener('resize', this.setContainerWidth);
95
+ document.addEventListener('keydown', this.onKeyPress, false);
96
+ }
97
+ }, {
98
+ key: 'componentWillReceiveProps',
99
+ value: function componentWillReceiveProps(newProps) {
100
+ if (newProps.url !== this.props.url) {
101
+ this.initialize(newProps);
102
+ }
103
+ }
104
+ }, {
105
+ key: 'componentWillUnmount',
106
+ value: function componentWillUnmount() {
107
+ window.removeEventListener('resize', this.setContainerWidth);
108
+ document.removeEventListener('keydown', this.onKeyPress, false);
109
+ }
110
+ }, {
111
+ key: 'setContainerWidth',
112
+ value: function setContainerWidth() {
113
+ var container = this.refs.container;
114
+
115
+ var containerWidth = container.offsetWidth - 60;
116
+ this.setState({ containerWidth: containerWidth });
117
+ }
118
+ }, {
119
+ key: 'onKeyPress',
120
+ value: function onKeyPress(e) {
121
+ var key = e.keyCode || e.which;
122
+ if (key === 32) this.state.play ? this.refs.audio.pause() : this.refs.audio.play();
123
+ }
124
+ }, {
125
+ key: 'initialize',
126
+ value: function initialize(props) {
127
+ var _this3 = this;
128
+
129
+ var url = props.url;
130
+
131
+ (0, _audio.getWaveform)(url).then(function (waveform) {
132
+ _this3.setState({ waveform: waveform, loading: false });
133
+ });
134
+ }
135
+ }, {
136
+ key: 'render',
137
+ value: function render() {
138
+ var _this4 = this;
139
+
140
+ var url = this.props.url;
141
+ var _state = this.state,
142
+ loading = _state.loading,
143
+ duration = _state.duration,
144
+ waveform = _state.waveform,
145
+ play = _state.play,
146
+ currentTime = _state.currentTime,
147
+ containerWidth = _state.containerWidth,
148
+ speed = _state.speed,
149
+ _state$currentRange = _state.currentRange,
150
+ currentRange = _state$currentRange === undefined ? {} : _state$currentRange;
151
+ var _currentRange$startTi = currentRange.startTime,
152
+ startTime = _currentRange$startTi === undefined ? 0 : _currentRange$startTi,
153
+ _currentRange$endTime = currentRange.endTime,
154
+ endTime = _currentRange$endTime === undefined ? 0 : _currentRange$endTime;
155
+
156
+ return _react2.default.createElement(
157
+ 'div',
158
+ { className: (0, _noImportant.css)(styles.player) },
159
+ _react2.default.createElement(
160
+ 'div',
161
+ { className: (0, _noImportant.css)(styles.play_and_stop), onClick: function onClick() {
162
+ return play ? _this4.refs.audio.pause() : _this4.refs.audio.play();
163
+ } },
164
+ _react2.default.createElement(
165
+ _FontIcon2.default,
166
+ { className: 'material-icons' },
167
+ play ? 'pause' : 'play_arrow'
168
+ )
169
+ ),
170
+ _react2.default.createElement(_Audio2.default, { onChange: function onChange(state) {
171
+ return _this4.setState(_extends({}, state));
172
+ }, ref: 'audio', src: url }),
173
+ _react2.default.createElement(
174
+ 'div',
175
+ { className: (0, _noImportant.css)(styles.timeline), ref: 'container' },
176
+ _react2.default.createElement(_Wave2.default, { currentTime: currentTime, width: containerWidth, height: 50, range: { startTime: startTime, endTime: endTime }, isLoading: loading, waveform: waveform }),
177
+ _react2.default.createElement(_reactInputRange2.default, { classNames: _fallbackTimelineClassNames2.default, formatLabel: _utils.timeConvert, maxValue: duration || 1, minValue: 0, onChange: function onChange(c, _ref) {
178
+ var min = _ref.min,
179
+ max = _ref.max;
180
+ return _this4.refs.audio.setRange({ startTime: min, endTime: max });
181
+ }, value: { min: startTime, max: endTime } }),
182
+ _react2.default.createElement(_reactInputRange2.default, { classNames: _timelineClassNames2.default, formatLabel: _utils.timeConvert, maxValue: duration || 1, minValue: 0, value: this.state.currentTime, onChange: function onChange(c, v) {
183
+ return _this4.refs.audio.setCurrentTime(v);
184
+ } })
185
+ ),
186
+ _react2.default.createElement(
187
+ 'div',
188
+ { onClick: function onClick() {
189
+ return _this4.refs.audio.setLoop(!_this4.state.loop);
190
+ }, className: 'Repeat_menu ' + (0, _noImportant.css)(styles.repeat_menu) },
191
+ _react2.default.createElement(
192
+ _FontIcon2.default,
193
+ { style: { color: this.state.loop ? '#a20025' : '' }, className: 'material-icons' },
194
+ 'loop'
195
+ )
196
+ ),
197
+ _react2.default.createElement(
198
+ 'div',
199
+ { className: 'Speed_menu ' + (0, _noImportant.css)(styles.speed_menu) },
200
+ _react2.default.createElement(_Speed2.default, { speed: speed, onSpeedChange: function onSpeedChange(speed) {
201
+ return _this4.refs.audio.setSpeed(speed);
202
+ } })
203
+ ),
204
+ _react2.default.createElement(
205
+ 'div',
206
+ { className: 'Volume ' + (0, _noImportant.css)(styles.volume) },
207
+ _react2.default.createElement(_reactInputRange2.default, { classNames: _volumeClassNames2.default, maxValue: 100, minValue: 0, value: this.state.volume, onChange: function onChange(c, v) {
208
+ return _this4.refs.audio.setVolume(v);
209
+ } })
210
+ )
211
+ );
212
+ }
213
+ }]);
214
+
215
+ return Player;
216
+ }(_react.Component);
217
+
218
+ exports.default = Player;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _noImportant = require('aphrodite/no-important');
8
+
9
+ var _timelineClassNames = require('./timelineClassNames');
10
+
11
+ var _timelineClassNames2 = _interopRequireDefault(_timelineClassNames);
12
+
13
+ var _utils = require('../utils');
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ var styles = _noImportant.StyleSheet.create({
18
+ trackContainer: {
19
+ backgroundColor: '#e51400',
20
+ borderRadius: 0,
21
+ height: 2
22
+ },
23
+ labelContainer: {
24
+ top: -44
25
+ },
26
+ range: {
27
+ marginTop: -2,
28
+ position: 'absolute',
29
+ width: 'calc(100% - 60px)'
30
+ },
31
+ slider: {
32
+ background: '#888',
33
+ width: 2,
34
+ borderRadius: 0,
35
+ height: 53,
36
+ top: -51,
37
+ border: 'none',
38
+ margin: 0,
39
+ ':active': { transform: 'scale(1.1)' }
40
+ }
41
+ });
42
+
43
+ exports.default = (0, _utils.concatStyle)(_timelineClassNames2.default, styles);