@lls/lls-audio 0.0.34 → 0.0.36
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 +2 -2
- package/player/Audio.js +1 -1
- package/player/Range.js +1 -1
- package/player/index.js +187 -112
- package/player/styles/styles.js +30 -6
- package/stories/player.js +25 -3
- package/stories/playerRange.js +11 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lls/lls-audio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@kadira/storybook": "^2.21.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"node": ">=0.12.0"
|
|
37
37
|
},
|
|
38
38
|
"repository": {
|
|
39
|
-
"url": "github.com/lelivrescolaire/
|
|
39
|
+
"url": "github.com/lelivrescolaire/lls-audio"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"start": "npm run storybook",
|
package/player/Audio.js
CHANGED
|
@@ -121,7 +121,7 @@ var Player = function (_Component) {
|
|
|
121
121
|
_this.setStateWithCallback = function (state) {
|
|
122
122
|
var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
123
123
|
return _this.setState(state, function () {
|
|
124
|
-
_this.props.onChange(state);
|
|
124
|
+
_this.props.onChange(_this.state);
|
|
125
125
|
cb ? cb() : false;
|
|
126
126
|
});
|
|
127
127
|
};
|
package/player/Range.js
CHANGED
|
@@ -144,7 +144,7 @@ var Range = function Range(_ref) {
|
|
|
144
144
|
(0, _utils.timeConvert)(range.startTime) + ' - ' + (0, _utils.timeConvert)(range.endTime)
|
|
145
145
|
),
|
|
146
146
|
_react2.default.createElement(_llsIcons2.default, { className: (0, _noImportant.css)(styles.delete), onClick: function onClick() {
|
|
147
|
-
return onClickDeleteRange
|
|
147
|
+
return onClickDeleteRange && onClickDeleteRange(range.id);
|
|
148
148
|
}, name: 'fermer' })
|
|
149
149
|
);
|
|
150
150
|
})
|
package/player/index.js
CHANGED
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
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
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; }; }();
|
|
10
8
|
|
|
11
9
|
var _react = require('react');
|
|
@@ -106,6 +104,30 @@ var Player = function (_Component) {
|
|
|
106
104
|
return _this.refs.audio.setRange(range);
|
|
107
105
|
};
|
|
108
106
|
|
|
107
|
+
_this.audioStateChange = function (newState) {
|
|
108
|
+
var previousPlay = _this.state.play;
|
|
109
|
+
var newPlay = newState.play;
|
|
110
|
+
var _this$props = _this.props,
|
|
111
|
+
src = _this$props.src,
|
|
112
|
+
_this$props$on = _this$props.on,
|
|
113
|
+
on = _this$props$on === undefined ? {} : _this$props$on;
|
|
114
|
+
|
|
115
|
+
// Trigger onPause & onPlay callbacks if necessary
|
|
116
|
+
|
|
117
|
+
if (!previousPlay && newPlay && on.play) {
|
|
118
|
+
on.play({
|
|
119
|
+
url: src
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (previousPlay && !newPlay && on.pause) {
|
|
123
|
+
on.pause({
|
|
124
|
+
url: src
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_this.setState(newState);
|
|
129
|
+
};
|
|
130
|
+
|
|
109
131
|
_this.state = {
|
|
110
132
|
waveform: false,
|
|
111
133
|
loading: true,
|
|
@@ -113,6 +135,7 @@ var Player = function (_Component) {
|
|
|
113
135
|
};
|
|
114
136
|
_this.setContainerWidth = (0, _utils.debounce)(_this.setContainerWidth.bind(_this), 500);
|
|
115
137
|
_this.onKeyPress = _this.onKeyPress.bind(_this);
|
|
138
|
+
_this.audioStateChange = _this.audioStateChange.bind(_this);
|
|
116
139
|
return _this;
|
|
117
140
|
}
|
|
118
141
|
|
|
@@ -166,35 +189,44 @@ var Player = function (_Component) {
|
|
|
166
189
|
|
|
167
190
|
var src = props.src,
|
|
168
191
|
_props$visible = props.visible,
|
|
169
|
-
visible = _props$visible === undefined ? true : _props$visible
|
|
170
|
-
|
|
192
|
+
visible = _props$visible === undefined ? true : _props$visible,
|
|
193
|
+
_props$on = props.on,
|
|
194
|
+
on = _props$on === undefined ? {} : _props$on;
|
|
195
|
+
|
|
196
|
+
if (on.loadStart) {
|
|
197
|
+
on.loadStart({
|
|
198
|
+
url: src
|
|
199
|
+
}); // notify start of loading
|
|
200
|
+
}
|
|
171
201
|
(0, _audio.getWaveform)(src).then(function (waveform) {
|
|
172
202
|
_this3.setState({
|
|
173
203
|
waveform: waveform,
|
|
174
204
|
loading: false
|
|
175
205
|
});
|
|
206
|
+
// notify end of loading
|
|
207
|
+
if (on.loadSuccess) {
|
|
208
|
+
on.loadSuccess({
|
|
209
|
+
url: src,
|
|
210
|
+
duration: waveform.duration
|
|
211
|
+
});
|
|
212
|
+
}
|
|
176
213
|
});
|
|
177
214
|
}
|
|
178
215
|
}, {
|
|
179
216
|
key: 'render',
|
|
180
217
|
value: function render() {
|
|
181
|
-
var _this4 = this;
|
|
182
|
-
|
|
183
218
|
var _props = this.props,
|
|
219
|
+
title = _props.title,
|
|
184
220
|
_props$autoPlay = _props.autoPlay,
|
|
185
221
|
autoPlay = _props$autoPlay === undefined ? false : _props$autoPlay,
|
|
186
222
|
src = _props.src,
|
|
187
223
|
className = _props.className,
|
|
188
|
-
_props$
|
|
189
|
-
|
|
224
|
+
_props$on2 = _props.on,
|
|
225
|
+
on = _props$on2 === undefined ? {} : _props$on2,
|
|
190
226
|
_props$ranges = _props.ranges,
|
|
191
227
|
ranges = _props$ranges === undefined ? [] : _props$ranges,
|
|
192
228
|
_props$displayRange = _props.displayRange,
|
|
193
229
|
displayRange = _props$displayRange === undefined ? false : _props$displayRange,
|
|
194
|
-
_props$onClickAddRang = _props.onClickAddRange,
|
|
195
|
-
onClickAddRange = _props$onClickAddRang === undefined ? false : _props$onClickAddRang,
|
|
196
|
-
_props$onClickDeleteR = _props.onClickDeleteRange,
|
|
197
|
-
onClickDeleteRange = _props$onClickDeleteR === undefined ? false : _props$onClickDeleteR,
|
|
198
230
|
_props$preload = _props.preload,
|
|
199
231
|
preload = _props$preload === undefined ? 'auto' : _props$preload,
|
|
200
232
|
_props$caption = _props.caption,
|
|
@@ -220,67 +252,70 @@ var Player = function (_Component) {
|
|
|
220
252
|
return _react2.default.createElement(
|
|
221
253
|
'div',
|
|
222
254
|
{ className: 'Audio_player ' + (0, _noImportant.css)(styles.player) + ' ' + className },
|
|
223
|
-
_react2.default.createElement(
|
|
224
|
-
_react2.default.createElement(_Audio2.default, { autoPlay: autoPlay, onChange: function onChange(state) {
|
|
225
|
-
return _this4.setState(_extends({}, state));
|
|
226
|
-
}, ref: 'audio', src: src, preload: preload }),
|
|
227
|
-
_react2.default.createElement(SpeedWrapper, { speed: speed, audioRef: this.refs.audio }),
|
|
228
|
-
_react2.default.createElement(LoopWrapper, { loop: loop, audioRef: this.refs.audio }),
|
|
229
|
-
displayRange ? _react2.default.createElement(_Range2.default, {
|
|
230
|
-
setRange: this.setRange,
|
|
231
|
-
onClickAddRange: onClickAddRange,
|
|
232
|
-
onClickDeleteRange: onClickDeleteRange,
|
|
233
|
-
ranges: ranges,
|
|
234
|
-
startTime: startTime,
|
|
235
|
-
endTime: endTime
|
|
236
|
-
}) : null,
|
|
255
|
+
_react2.default.createElement(Title, { content: title }),
|
|
237
256
|
_react2.default.createElement(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
_react2.default.createElement(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
257
|
+
Content,
|
|
258
|
+
null,
|
|
259
|
+
_react2.default.createElement(PlayWrapper, { play: play, audioRef: this.refs.audio }),
|
|
260
|
+
_react2.default.createElement(_Audio2.default, { autoPlay: autoPlay, onChange: this.audioStateChange, ref: 'audio', src: src, preload: preload }),
|
|
261
|
+
_react2.default.createElement(SpeedWrapper, { speed: speed, audioRef: this.refs.audio }),
|
|
262
|
+
_react2.default.createElement(LoopWrapper, { loop: loop, audioRef: this.refs.audio }),
|
|
263
|
+
displayRange && _react2.default.createElement(_Range2.default, {
|
|
264
|
+
setRange: this.setRange,
|
|
265
|
+
onClickAddRange: on.clickAddRange,
|
|
266
|
+
onClickDeleteRange: on.clickDeleteRange,
|
|
267
|
+
ranges: ranges,
|
|
268
|
+
startTime: startTime,
|
|
269
|
+
endTime: endTime
|
|
270
|
+
}),
|
|
245
271
|
_react2.default.createElement(
|
|
246
272
|
'div',
|
|
247
|
-
{ className: (0, _noImportant.css)(styles.
|
|
248
|
-
_react2.default.createElement(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
273
|
+
{ className: (0, _noImportant.css)(styles.waveAndTimes) },
|
|
274
|
+
_react2.default.createElement(
|
|
275
|
+
'div',
|
|
276
|
+
{ className: (0, _noImportant.css)(styles.time, styles.currentTime) },
|
|
277
|
+
(0, _utils.timeConvert)(currentTime)
|
|
278
|
+
),
|
|
279
|
+
_react2.default.createElement(
|
|
280
|
+
'div',
|
|
281
|
+
{ className: (0, _noImportant.css)(styles.timeline), ref: 'container' },
|
|
282
|
+
loading ? _react2.default.createElement(Loader, null) : _react2.default.createElement(WaveTimeline, {
|
|
283
|
+
audioRef: this.refs.audio,
|
|
284
|
+
currentTime: currentTime,
|
|
285
|
+
containerWidth: containerWidth,
|
|
286
|
+
startTime: startTime,
|
|
287
|
+
endTime: endTime,
|
|
288
|
+
loading: loading,
|
|
289
|
+
waveform: waveform,
|
|
290
|
+
fallbackTimelineClassNames: _fallbackTimelineClassNames2.default,
|
|
291
|
+
timeConvert: _utils.timeConvert,
|
|
292
|
+
duration: duration,
|
|
293
|
+
timelineClassNames: _timelineClassNames2.default
|
|
294
|
+
}),
|
|
295
|
+
_react2.default.createElement(Timeline, {
|
|
296
|
+
fallbackRangelineClassNames: _fallbackRangelineClassNames2.default,
|
|
297
|
+
timeConvert: _utils.timeConvert,
|
|
298
|
+
duration: duration,
|
|
299
|
+
audioRef: this.refs.audio,
|
|
300
|
+
currentTime: currentTime,
|
|
301
|
+
startTime: startTime,
|
|
302
|
+
endTime: endTime,
|
|
303
|
+
timeLineBottom: _timeLineBottom2.default
|
|
304
|
+
})
|
|
305
|
+
),
|
|
306
|
+
_react2.default.createElement(
|
|
307
|
+
'div',
|
|
308
|
+
{ className: (0, _noImportant.css)(styles.time, styles.totalTime) },
|
|
309
|
+
(0, _utils.timeConvert)(duration - currentTime)
|
|
310
|
+
)
|
|
271
311
|
),
|
|
272
|
-
_react2.default.createElement(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
_react2.default.createElement(VolumeRange, { audioRef: this.refs.audio, volume: volume, volumeClassNames: _volumeClassNames2.default }),
|
|
280
|
-
_react2.default.createElement(_llsIcons2.default, { className: 'Close ' + (0, _noImportant.css)(styles.close), onClick: function onClick() {
|
|
281
|
-
return onClose();
|
|
282
|
-
}, name: 'fermer' }),
|
|
283
|
-
caption ? _react2.default.createElement(_Caption2.default, { caption: caption }) : null
|
|
312
|
+
_react2.default.createElement(VolumeIcon, { audioRef: this.refs.audio, volume: volume }),
|
|
313
|
+
_react2.default.createElement(VolumeRange, { audioRef: this.refs.audio, volume: volume, volumeClassNames: _volumeClassNames2.default }),
|
|
314
|
+
_react2.default.createElement(_llsIcons2.default, { className: 'Close ' + (0, _noImportant.css)(styles.close), onClick: function onClick() {
|
|
315
|
+
on.close && on.close({ url: src });
|
|
316
|
+
}, name: 'fermer' }),
|
|
317
|
+
caption && _react2.default.createElement(_Caption2.default, { caption: caption })
|
|
318
|
+
)
|
|
284
319
|
);
|
|
285
320
|
}
|
|
286
321
|
}]);
|
|
@@ -290,9 +325,49 @@ var Player = function (_Component) {
|
|
|
290
325
|
|
|
291
326
|
/**** PLAYER COMPONENTS ****/
|
|
292
327
|
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
|
|
328
|
+
var Loader = function Loader() {
|
|
329
|
+
return _react2.default.createElement(
|
|
330
|
+
'div',
|
|
331
|
+
{ className: (0, _noImportant.css)(styles.loader) },
|
|
332
|
+
_react2.default.createElement(
|
|
333
|
+
'span',
|
|
334
|
+
{ className: (0, _noImportant.css)(styles.loaderText) },
|
|
335
|
+
'chargement en cours'
|
|
336
|
+
),
|
|
337
|
+
_react2.default.createElement(
|
|
338
|
+
'span',
|
|
339
|
+
{ className: (0, _noImportant.css)(styles.loaderOne) },
|
|
340
|
+
'.'
|
|
341
|
+
),
|
|
342
|
+
_react2.default.createElement(
|
|
343
|
+
'span',
|
|
344
|
+
{ className: (0, _noImportant.css)(styles.loaderTwo) },
|
|
345
|
+
'.'
|
|
346
|
+
),
|
|
347
|
+
_react2.default.createElement(
|
|
348
|
+
'span',
|
|
349
|
+
{ className: (0, _noImportant.css)(styles.loaderThree) },
|
|
350
|
+
'.'
|
|
351
|
+
)
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
var Title = function Title(_ref) {
|
|
356
|
+
var content = _ref.content;
|
|
357
|
+
return _react2.default.createElement('div', { className: (0, _noImportant.css)(styles.title), dangerouslySetInnerHTML: { __html: content } });
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
var Content = function Content(_ref2) {
|
|
361
|
+
var children = _ref2.children;
|
|
362
|
+
return _react2.default.createElement(
|
|
363
|
+
'div',
|
|
364
|
+
{ className: (0, _noImportant.css)(styles.content) },
|
|
365
|
+
children
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
var PlayWrapper = function PlayWrapper(_ref3) {
|
|
369
|
+
var play = _ref3.play,
|
|
370
|
+
audioRef = _ref3.audioRef;
|
|
296
371
|
return _react2.default.createElement(
|
|
297
372
|
'div',
|
|
298
373
|
{ className: (0, _noImportant.css)(styles.play_and_stop), onClick: function onClick() {
|
|
@@ -302,9 +377,9 @@ var PlayWrapper = function PlayWrapper(_ref) {
|
|
|
302
377
|
);
|
|
303
378
|
};
|
|
304
379
|
|
|
305
|
-
var SpeedWrapper = function SpeedWrapper(
|
|
306
|
-
var speed =
|
|
307
|
-
audioRef =
|
|
380
|
+
var SpeedWrapper = function SpeedWrapper(_ref4) {
|
|
381
|
+
var speed = _ref4.speed,
|
|
382
|
+
audioRef = _ref4.audioRef;
|
|
308
383
|
return _react2.default.createElement(
|
|
309
384
|
'div',
|
|
310
385
|
{ className: 'Speed_menu ' + (0, _noImportant.css)(styles.speed_menu) },
|
|
@@ -314,9 +389,9 @@ var SpeedWrapper = function SpeedWrapper(_ref2) {
|
|
|
314
389
|
);
|
|
315
390
|
};
|
|
316
391
|
|
|
317
|
-
var LoopWrapper = function LoopWrapper(
|
|
318
|
-
var loop =
|
|
319
|
-
audioRef =
|
|
392
|
+
var LoopWrapper = function LoopWrapper(_ref5) {
|
|
393
|
+
var loop = _ref5.loop,
|
|
394
|
+
audioRef = _ref5.audioRef;
|
|
320
395
|
return _react2.default.createElement(
|
|
321
396
|
'div',
|
|
322
397
|
{ onClick: function onClick() {
|
|
@@ -326,18 +401,18 @@ var LoopWrapper = function LoopWrapper(_ref3) {
|
|
|
326
401
|
);
|
|
327
402
|
};
|
|
328
403
|
|
|
329
|
-
var WaveTimeline = function WaveTimeline(
|
|
330
|
-
var currentTime =
|
|
331
|
-
containerWidth =
|
|
332
|
-
startTime =
|
|
333
|
-
endTime =
|
|
334
|
-
loading =
|
|
335
|
-
waveform =
|
|
336
|
-
fallbackTimelineClassNames =
|
|
337
|
-
timeConvert =
|
|
338
|
-
duration =
|
|
339
|
-
audioRef =
|
|
340
|
-
timelineClassNames =
|
|
404
|
+
var WaveTimeline = function WaveTimeline(_ref6) {
|
|
405
|
+
var currentTime = _ref6.currentTime,
|
|
406
|
+
containerWidth = _ref6.containerWidth,
|
|
407
|
+
startTime = _ref6.startTime,
|
|
408
|
+
endTime = _ref6.endTime,
|
|
409
|
+
loading = _ref6.loading,
|
|
410
|
+
waveform = _ref6.waveform,
|
|
411
|
+
fallbackTimelineClassNames = _ref6.fallbackTimelineClassNames,
|
|
412
|
+
timeConvert = _ref6.timeConvert,
|
|
413
|
+
duration = _ref6.duration,
|
|
414
|
+
audioRef = _ref6.audioRef,
|
|
415
|
+
timelineClassNames = _ref6.timelineClassNames;
|
|
341
416
|
return _react2.default.createElement(
|
|
342
417
|
'div',
|
|
343
418
|
{ className: (0, _noImportant.css)(styles.wavetimeline) },
|
|
@@ -354,9 +429,9 @@ var WaveTimeline = function WaveTimeline(_ref4) {
|
|
|
354
429
|
formatLabel: timeConvert,
|
|
355
430
|
maxValue: Math.round(duration) || 1,
|
|
356
431
|
minValue: 0,
|
|
357
|
-
onChange: function onChange(c,
|
|
358
|
-
var min =
|
|
359
|
-
max =
|
|
432
|
+
onChange: function onChange(c, _ref7) {
|
|
433
|
+
var min = _ref7.min,
|
|
434
|
+
max = _ref7.max;
|
|
360
435
|
return audioRef.setRange({ startTime: min, endTime: max });
|
|
361
436
|
},
|
|
362
437
|
value: { min: startTime, max: endTime }
|
|
@@ -374,15 +449,15 @@ var WaveTimeline = function WaveTimeline(_ref4) {
|
|
|
374
449
|
);
|
|
375
450
|
};
|
|
376
451
|
|
|
377
|
-
var Timeline = function Timeline(
|
|
378
|
-
var fallbackRangelineClassNames =
|
|
379
|
-
timeConvert =
|
|
380
|
-
duration =
|
|
381
|
-
audioRef =
|
|
382
|
-
currentTime =
|
|
383
|
-
startTime =
|
|
384
|
-
endTime =
|
|
385
|
-
timeLineBottom =
|
|
452
|
+
var Timeline = function Timeline(_ref8) {
|
|
453
|
+
var fallbackRangelineClassNames = _ref8.fallbackRangelineClassNames,
|
|
454
|
+
timeConvert = _ref8.timeConvert,
|
|
455
|
+
duration = _ref8.duration,
|
|
456
|
+
audioRef = _ref8.audioRef,
|
|
457
|
+
currentTime = _ref8.currentTime,
|
|
458
|
+
startTime = _ref8.startTime,
|
|
459
|
+
endTime = _ref8.endTime,
|
|
460
|
+
timeLineBottom = _ref8.timeLineBottom;
|
|
386
461
|
return _react2.default.createElement(
|
|
387
462
|
'div',
|
|
388
463
|
{ className: (0, _noImportant.css)(styles.fallback) },
|
|
@@ -391,9 +466,9 @@ var Timeline = function Timeline(_ref6) {
|
|
|
391
466
|
formatLabel: timeConvert,
|
|
392
467
|
maxValue: Math.round(duration) || 1,
|
|
393
468
|
minValue: 0,
|
|
394
|
-
onChange: function onChange(c,
|
|
395
|
-
var min =
|
|
396
|
-
max =
|
|
469
|
+
onChange: function onChange(c, _ref9) {
|
|
470
|
+
var min = _ref9.min,
|
|
471
|
+
max = _ref9.max;
|
|
397
472
|
return audioRef.setRange({ startTime: min, endTime: max });
|
|
398
473
|
},
|
|
399
474
|
value: { min: startTime, max: endTime }
|
|
@@ -410,9 +485,9 @@ var Timeline = function Timeline(_ref6) {
|
|
|
410
485
|
);
|
|
411
486
|
};
|
|
412
487
|
|
|
413
|
-
var VolumeIcon = function VolumeIcon(
|
|
414
|
-
var audioRef =
|
|
415
|
-
volume =
|
|
488
|
+
var VolumeIcon = function VolumeIcon(_ref10) {
|
|
489
|
+
var audioRef = _ref10.audioRef,
|
|
490
|
+
volume = _ref10.volume;
|
|
416
491
|
return _react2.default.createElement(
|
|
417
492
|
'div',
|
|
418
493
|
{ className: (0, _noImportant.css)(styles.iconAudio), onClick: function onClick() {
|
|
@@ -422,10 +497,10 @@ var VolumeIcon = function VolumeIcon(_ref8) {
|
|
|
422
497
|
);
|
|
423
498
|
};
|
|
424
499
|
|
|
425
|
-
var VolumeRange = function VolumeRange(
|
|
426
|
-
var volumeClassNames =
|
|
427
|
-
volume =
|
|
428
|
-
audioRef =
|
|
500
|
+
var VolumeRange = function VolumeRange(_ref11) {
|
|
501
|
+
var volumeClassNames = _ref11.volumeClassNames,
|
|
502
|
+
volume = _ref11.volume,
|
|
503
|
+
audioRef = _ref11.audioRef;
|
|
429
504
|
return _react2.default.createElement(
|
|
430
505
|
'div',
|
|
431
506
|
{ className: 'Volume ' + (0, _noImportant.css)(styles.volume) },
|
package/player/styles/styles.js
CHANGED
|
@@ -15,13 +15,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
15
15
|
exports.default = {
|
|
16
16
|
player: _defineProperty({
|
|
17
17
|
position: 'fixed',
|
|
18
|
-
display: 'flex',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
justifyContent: 'center',
|
|
21
18
|
boxShadow: '0 0 7px rgba(0, 0, 0, 0.32)',
|
|
22
19
|
backgroundColor: '#fff',
|
|
23
20
|
bottom: 0,
|
|
24
|
-
height:
|
|
21
|
+
height: 156,
|
|
25
22
|
zIndex: 10000000,
|
|
26
23
|
width: '90%',
|
|
27
24
|
marginLeft: '50%',
|
|
@@ -63,6 +60,21 @@ exports.default = {
|
|
|
63
60
|
order: 2,
|
|
64
61
|
margin: '0px 28px'
|
|
65
62
|
}),
|
|
63
|
+
content: {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
marginTop: 20,
|
|
68
|
+
height: 85
|
|
69
|
+
},
|
|
70
|
+
title: {
|
|
71
|
+
color: '#474f6f',
|
|
72
|
+
fontSize: '10px',
|
|
73
|
+
fontWeight: 'bold',
|
|
74
|
+
lineHeight: '36px',
|
|
75
|
+
paddingLeft: '15px',
|
|
76
|
+
borderBottom: '1px solid #e6e6e7'
|
|
77
|
+
},
|
|
66
78
|
play_and_stop: (_play_and_stop = {
|
|
67
79
|
height: '100%',
|
|
68
80
|
width: 40
|
|
@@ -76,10 +88,22 @@ exports.default = {
|
|
|
76
88
|
wavetimeline: _defineProperty({}, _mediaQueries.MOBILE, {
|
|
77
89
|
display: 'none'
|
|
78
90
|
}),
|
|
91
|
+
loader: {
|
|
92
|
+
height: 60,
|
|
93
|
+
color: '#00b3df',
|
|
94
|
+
fontSize: 10,
|
|
95
|
+
fontWeight: 'bold',
|
|
96
|
+
lineHeight: '60px',
|
|
97
|
+
textAlign: 'center'
|
|
98
|
+
},
|
|
99
|
+
loaderText: {
|
|
100
|
+
textTransform: 'uppercase'
|
|
101
|
+
},
|
|
102
|
+
loaderOne: {},
|
|
103
|
+
loaderTwo: {},
|
|
104
|
+
loaderThree: {},
|
|
79
105
|
timeline: _defineProperty({
|
|
80
|
-
//width: 'calc(100% - 520px)',
|
|
81
106
|
width: '100%',
|
|
82
|
-
height: 60,
|
|
83
107
|
margin: '0px 20px',
|
|
84
108
|
position: 'relative',
|
|
85
109
|
display: 'flex',
|
package/stories/player.js
CHANGED
|
@@ -46,11 +46,33 @@ var PlayerExample = function (_Component) {
|
|
|
46
46
|
autoPlay = _props.autoPlay,
|
|
47
47
|
caption = _props.caption;
|
|
48
48
|
|
|
49
|
+
var cb = {
|
|
50
|
+
loadStart: function loadStart(_ref) {
|
|
51
|
+
var url = _ref.url;
|
|
52
|
+
console.log("load start");
|
|
53
|
+
},
|
|
54
|
+
loadSuccess: function loadSuccess(_ref2) {
|
|
55
|
+
var url = _ref2.url,
|
|
56
|
+
duration = _ref2.duration;
|
|
57
|
+
console.log("load success", url, duration);
|
|
58
|
+
},
|
|
59
|
+
play: function play(_ref3) {
|
|
60
|
+
var url = _ref3.url;
|
|
61
|
+
console.log("play", url);
|
|
62
|
+
},
|
|
63
|
+
pause: function pause(_ref4) {
|
|
64
|
+
var url = _ref4.url;
|
|
65
|
+
console.log("pause", url);
|
|
66
|
+
},
|
|
67
|
+
close: function close() {
|
|
68
|
+
console.log("close");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
49
71
|
return _react2.default.createElement(
|
|
50
72
|
'div',
|
|
51
73
|
null,
|
|
52
|
-
_react2.default.createElement('input', { style: { width: 'calc(100% - 20px)', padding: 10 }, onChange: function onChange(
|
|
53
|
-
var value =
|
|
74
|
+
_react2.default.createElement('input', { style: { width: 'calc(100% - 20px)', padding: 10 }, onChange: function onChange(_ref5) {
|
|
75
|
+
var value = _ref5.target.value;
|
|
54
76
|
return _this2.setState({ url: value });
|
|
55
77
|
}, value: this.state.url }),
|
|
56
78
|
_react2.default.createElement(
|
|
@@ -67,7 +89,7 @@ var PlayerExample = function (_Component) {
|
|
|
67
89
|
'http://lls-media-public.s3.amazonaws.com/upload/LeLivreScolaire/p15vcjbl4lvpl9l7g8ov8ammh1.mp3'
|
|
68
90
|
)
|
|
69
91
|
),
|
|
70
|
-
_react2.default.createElement(_player2.default, { autoPlay: autoPlay, src: this.state.url, ranges: ranges, visible: true, caption: caption })
|
|
92
|
+
_react2.default.createElement(_player2.default, { title: 'Audio: un audio de la BBC', on: cb, autoPlay: autoPlay, src: this.state.url, ranges: ranges, visible: true, caption: caption })
|
|
71
93
|
);
|
|
72
94
|
}
|
|
73
95
|
}]);
|
package/stories/playerRange.js
CHANGED
|
@@ -50,20 +50,23 @@ var PlayerExample = function (_Component) {
|
|
|
50
50
|
ranges = _state.ranges,
|
|
51
51
|
url = _state.url;
|
|
52
52
|
|
|
53
|
+
var on = {
|
|
54
|
+
clickAddRange: function clickAddRange(r) {
|
|
55
|
+
return _this2.setState({ ranges: [].concat(_toConsumableArray(ranges), [_extends({ id: ranges.length }, r)]) });
|
|
56
|
+
},
|
|
57
|
+
clickDeleteRange: function clickDeleteRange(id) {
|
|
58
|
+
return _this2.setState({ ranges: ranges.filter(function (r) {
|
|
59
|
+
return r.id != id;
|
|
60
|
+
}) });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
53
63
|
return _react2.default.createElement(
|
|
54
64
|
'div',
|
|
55
65
|
null,
|
|
56
66
|
_react2.default.createElement(_player2.default, {
|
|
57
67
|
src: url,
|
|
58
68
|
displayRange: true,
|
|
59
|
-
|
|
60
|
-
return _this2.setState({ ranges: [].concat(_toConsumableArray(ranges), [_extends({ id: ranges.length }, r)]) });
|
|
61
|
-
},
|
|
62
|
-
onClickDeleteRange: function onClickDeleteRange(id) {
|
|
63
|
-
return _this2.setState({ ranges: ranges.filter(function (r) {
|
|
64
|
-
return r.id != id;
|
|
65
|
-
}) });
|
|
66
|
-
},
|
|
69
|
+
on: on,
|
|
67
70
|
ranges: ranges,
|
|
68
71
|
visible: true
|
|
69
72
|
})
|