@micromag/element-audio 0.2.337 → 0.2.352
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/es/index.js +3 -3
- package/lib/index.js +52 -51
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -212,6 +212,7 @@ AudioWave.defaultProps = defaultProps$1;
|
|
|
212
212
|
|
|
213
213
|
var styles = {"container":"micromag-element-audio-container","wave":"micromag-element-audio-wave"};
|
|
214
214
|
|
|
215
|
+
var _excluded = ["ref"];
|
|
215
216
|
var propTypes = {
|
|
216
217
|
media: PropTypes$1.audioMedia,
|
|
217
218
|
apiRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
@@ -299,7 +300,7 @@ var Audio = function Audio(_ref) {
|
|
|
299
300
|
onVolumeChanged: onVolumeChanged
|
|
300
301
|
}),
|
|
301
302
|
ref = _useMediaApi.ref,
|
|
302
|
-
api = _objectWithoutProperties(_useMediaApi,
|
|
303
|
+
api = _objectWithoutProperties(_useMediaApi, _excluded);
|
|
303
304
|
|
|
304
305
|
if (apiRef !== null) {
|
|
305
306
|
apiRef.current = api;
|
|
@@ -424,5 +425,4 @@ var Audio$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
424
425
|
}, props));
|
|
425
426
|
});
|
|
426
427
|
|
|
427
|
-
export
|
|
428
|
-
export { AudioWave };
|
|
428
|
+
export { AudioWave, Audio$1 as default };
|
package/lib/index.js
CHANGED
|
@@ -30,19 +30,19 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
|
30
30
|
var styles$1 = {"container":"micromag-element-audio-audio-wave-container","button":"micromag-element-audio-audio-wave-button","canvasBackground":"micromag-element-audio-audio-wave-canvasBackground","canvasProgress":"micromag-element-audio-audio-wave-canvasProgress"};
|
|
31
31
|
|
|
32
32
|
var propTypes$1 = {
|
|
33
|
-
currentTime: PropTypes__default[
|
|
34
|
-
duration: PropTypes__default[
|
|
35
|
-
playing: PropTypes__default[
|
|
36
|
-
sampleWidth: PropTypes__default[
|
|
37
|
-
sampleMargin: PropTypes__default[
|
|
38
|
-
minSampleHeight: PropTypes__default[
|
|
39
|
-
backgroundColor: PropTypes__default[
|
|
40
|
-
progressColor: PropTypes__default[
|
|
41
|
-
audioLevels: PropTypes__default[
|
|
42
|
-
className: PropTypes__default[
|
|
43
|
-
onSeek: PropTypes__default[
|
|
44
|
-
onResume: PropTypes__default[
|
|
45
|
-
onReady: PropTypes__default[
|
|
33
|
+
currentTime: PropTypes__default["default"].number,
|
|
34
|
+
duration: PropTypes__default["default"].number,
|
|
35
|
+
playing: PropTypes__default["default"].bool,
|
|
36
|
+
sampleWidth: PropTypes__default["default"].number,
|
|
37
|
+
sampleMargin: PropTypes__default["default"].number,
|
|
38
|
+
minSampleHeight: PropTypes__default["default"].number,
|
|
39
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
40
|
+
progressColor: PropTypes__default["default"].string,
|
|
41
|
+
audioLevels: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number),
|
|
42
|
+
className: PropTypes__default["default"].string,
|
|
43
|
+
onSeek: PropTypes__default["default"].func,
|
|
44
|
+
onResume: PropTypes__default["default"].func,
|
|
45
|
+
onReady: PropTypes__default["default"].func
|
|
46
46
|
};
|
|
47
47
|
var defaultProps$1 = {
|
|
48
48
|
currentTime: null,
|
|
@@ -95,7 +95,7 @@ var AudioWave = function AudioWave(_ref) {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
}),
|
|
98
|
-
_useSpring2 = _slicedToArray__default[
|
|
98
|
+
_useSpring2 = _slicedToArray__default["default"](_useSpring, 2),
|
|
99
99
|
springProps = _useSpring2[0],
|
|
100
100
|
setSpringProps = _useSpring2[1];
|
|
101
101
|
|
|
@@ -187,7 +187,7 @@ var AudioWave = function AudioWave(_ref) {
|
|
|
187
187
|
}, [duration, playing, onSeek, onResume]);
|
|
188
188
|
var bind = reactUseGesture.useGesture({
|
|
189
189
|
onDrag: function onDrag(_ref3) {
|
|
190
|
-
var _ref3$xy = _slicedToArray__default[
|
|
190
|
+
var _ref3$xy = _slicedToArray__default["default"](_ref3.xy, 1),
|
|
191
191
|
x = _ref3$xy[0],
|
|
192
192
|
elapsedTime = _ref3.elapsedTime,
|
|
193
193
|
active = _ref3.active;
|
|
@@ -204,13 +204,13 @@ var AudioWave = function AudioWave(_ref) {
|
|
|
204
204
|
filterTaps: true
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
|
-
return /*#__PURE__*/React__default[
|
|
208
|
-
className: classNames__default[
|
|
207
|
+
return /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
|
|
208
|
+
className: classNames__default["default"]([styles$1.container, _defineProperty__default["default"]({}, className, className !== null)]),
|
|
209
209
|
ref: elRef
|
|
210
|
-
}, bind()), /*#__PURE__*/React__default[
|
|
210
|
+
}, bind()), /*#__PURE__*/React__default["default"].createElement("canvas", {
|
|
211
211
|
ref: canvasBackgroundRef,
|
|
212
212
|
className: styles$1.canvasBackground
|
|
213
|
-
}), /*#__PURE__*/React__default[
|
|
213
|
+
}), /*#__PURE__*/React__default["default"].createElement(web.animated.canvas, {
|
|
214
214
|
ref: canvasProgressRef,
|
|
215
215
|
className: styles$1.canvasProgress,
|
|
216
216
|
style: {
|
|
@@ -226,31 +226,32 @@ AudioWave.defaultProps = defaultProps$1;
|
|
|
226
226
|
|
|
227
227
|
var styles = {"container":"micromag-element-audio-container","wave":"micromag-element-audio-wave"};
|
|
228
228
|
|
|
229
|
+
var _excluded = ["ref"];
|
|
229
230
|
var propTypes = {
|
|
230
231
|
media: core$1.PropTypes.audioMedia,
|
|
231
|
-
apiRef: PropTypes__default[
|
|
232
|
-
current: PropTypes__default[
|
|
232
|
+
apiRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
|
|
233
|
+
current: PropTypes__default["default"].any
|
|
233
234
|
})]),
|
|
234
|
-
initialMuted: PropTypes__default[
|
|
235
|
-
autoPlay: PropTypes__default[
|
|
236
|
-
loop: PropTypes__default[
|
|
237
|
-
waveFake: PropTypes__default[
|
|
238
|
-
waveProps: PropTypes__default[
|
|
239
|
-
sampleWidth: PropTypes__default[
|
|
240
|
-
sampleMargin: PropTypes__default[
|
|
241
|
-
minSampleHeight: PropTypes__default[
|
|
235
|
+
initialMuted: PropTypes__default["default"].oneOf(['auto', true, false]),
|
|
236
|
+
autoPlay: PropTypes__default["default"].bool,
|
|
237
|
+
loop: PropTypes__default["default"].bool,
|
|
238
|
+
waveFake: PropTypes__default["default"].bool,
|
|
239
|
+
waveProps: PropTypes__default["default"].shape({
|
|
240
|
+
sampleWidth: PropTypes__default["default"].number,
|
|
241
|
+
sampleMargin: PropTypes__default["default"].number,
|
|
242
|
+
minSampleHeight: PropTypes__default["default"].number
|
|
242
243
|
}),
|
|
243
|
-
reduceBufferFactor: PropTypes__default[
|
|
244
|
-
className: PropTypes__default[
|
|
245
|
-
onReady: PropTypes__default[
|
|
246
|
-
onPlay: PropTypes__default[
|
|
247
|
-
onPause: PropTypes__default[
|
|
248
|
-
onEnded: PropTypes__default[
|
|
249
|
-
onSeeked: PropTypes__default[
|
|
250
|
-
onTimeUpdate: PropTypes__default[
|
|
251
|
-
onProgressStep: PropTypes__default[
|
|
252
|
-
onDurationChanged: PropTypes__default[
|
|
253
|
-
onVolumeChanged: PropTypes__default[
|
|
244
|
+
reduceBufferFactor: PropTypes__default["default"].number,
|
|
245
|
+
className: PropTypes__default["default"].string,
|
|
246
|
+
onReady: PropTypes__default["default"].func,
|
|
247
|
+
onPlay: PropTypes__default["default"].func,
|
|
248
|
+
onPause: PropTypes__default["default"].func,
|
|
249
|
+
onEnded: PropTypes__default["default"].func,
|
|
250
|
+
onSeeked: PropTypes__default["default"].func,
|
|
251
|
+
onTimeUpdate: PropTypes__default["default"].func,
|
|
252
|
+
onProgressStep: PropTypes__default["default"].func,
|
|
253
|
+
onDurationChanged: PropTypes__default["default"].func,
|
|
254
|
+
onVolumeChanged: PropTypes__default["default"].func
|
|
254
255
|
};
|
|
255
256
|
var defaultProps = {
|
|
256
257
|
media: null,
|
|
@@ -313,7 +314,7 @@ var Audio = function Audio(_ref) {
|
|
|
313
314
|
onVolumeChanged: onVolumeChanged
|
|
314
315
|
}),
|
|
315
316
|
ref = _useMediaApi.ref,
|
|
316
|
-
api = _objectWithoutProperties__default[
|
|
317
|
+
api = _objectWithoutProperties__default["default"](_useMediaApi, _excluded);
|
|
317
318
|
|
|
318
319
|
if (apiRef !== null) {
|
|
319
320
|
apiRef.current = api;
|
|
@@ -331,12 +332,12 @@ var Audio = function Audio(_ref) {
|
|
|
331
332
|
unMute = api.unMute;
|
|
332
333
|
|
|
333
334
|
var _useState = React.useState(null),
|
|
334
|
-
_useState2 = _slicedToArray__default[
|
|
335
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
335
336
|
audioLevels = _useState2[0],
|
|
336
337
|
setAudioLevels = _useState2[1];
|
|
337
338
|
|
|
338
339
|
var _useState3 = React.useState(null),
|
|
339
|
-
_useState4 = _slicedToArray__default[
|
|
340
|
+
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
340
341
|
blobUrl = _useState4[0],
|
|
341
342
|
setBlobUrl = _useState4[1];
|
|
342
343
|
|
|
@@ -345,7 +346,7 @@ var Audio = function Audio(_ref) {
|
|
|
345
346
|
|
|
346
347
|
if (url !== null && waveFake) {
|
|
347
348
|
var fakeLength = 1000;
|
|
348
|
-
setAudioLevels(_toConsumableArray__default[
|
|
349
|
+
setAudioLevels(_toConsumableArray__default["default"](new Array(fakeLength)).map(function () {
|
|
349
350
|
return Math.random();
|
|
350
351
|
}));
|
|
351
352
|
} else if (url !== null && typeof window !== 'undefined') {
|
|
@@ -406,9 +407,9 @@ var Audio = function Audio(_ref) {
|
|
|
406
407
|
pause();
|
|
407
408
|
}
|
|
408
409
|
}, [autoPlay]);
|
|
409
|
-
return /*#__PURE__*/React__default[
|
|
410
|
-
className: classNames__default[
|
|
411
|
-
}, /*#__PURE__*/React__default[
|
|
410
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
411
|
+
className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)])
|
|
412
|
+
}, /*#__PURE__*/React__default["default"].createElement("audio", {
|
|
412
413
|
key: url,
|
|
413
414
|
ref: ref,
|
|
414
415
|
src: waveFake ? url : blobUrl,
|
|
@@ -417,7 +418,7 @@ var Audio = function Audio(_ref) {
|
|
|
417
418
|
loop: loop,
|
|
418
419
|
crossOrigin: "anonymous",
|
|
419
420
|
preload: "none"
|
|
420
|
-
}), /*#__PURE__*/React__default[
|
|
421
|
+
}), /*#__PURE__*/React__default["default"].createElement(AudioWave, Object.assign({
|
|
421
422
|
className: styles.wave,
|
|
422
423
|
media: media,
|
|
423
424
|
currentTime: currentTime
|
|
@@ -432,11 +433,11 @@ var Audio = function Audio(_ref) {
|
|
|
432
433
|
|
|
433
434
|
Audio.propTypes = propTypes;
|
|
434
435
|
Audio.defaultProps = defaultProps;
|
|
435
|
-
var Audio$1 = /*#__PURE__*/React__default[
|
|
436
|
-
return /*#__PURE__*/React__default[
|
|
436
|
+
var Audio$1 = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
437
|
+
return /*#__PURE__*/React__default["default"].createElement(Audio, Object.assign({
|
|
437
438
|
apiRef: ref
|
|
438
439
|
}, props));
|
|
439
440
|
});
|
|
440
441
|
|
|
441
442
|
exports.AudioWave = AudioWave;
|
|
442
|
-
exports
|
|
443
|
+
exports["default"] = Audio$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-audio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.352",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.2.
|
|
56
|
-
"@micromag/element-closed-captions": "^0.2.
|
|
57
|
-
"@micromag/element-media-controls": "^0.2.
|
|
55
|
+
"@micromag/core": "^0.2.352",
|
|
56
|
+
"@micromag/element-closed-captions": "^0.2.352",
|
|
57
|
+
"@micromag/element-media-controls": "^0.2.352",
|
|
58
58
|
"@react-spring/core": "^9.1.1",
|
|
59
59
|
"@react-spring/web": "^9.1.1",
|
|
60
60
|
"classnames": "^2.2.6",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b80e8d43c1228b698516257f97aece96a57c80c7"
|
|
71
71
|
}
|