@rocket.chat/fuselage 0.32.0-dev.331 → 0.32.0-dev.332
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.
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const AudioPlayer: React.ForwardRefExoticComponent<{
|
|
3
3
|
src: string;
|
|
4
|
+
type?: string | undefined;
|
|
4
5
|
maxPlaybackSpeed?: number | undefined;
|
|
5
6
|
minPlaybackSpeed?: number | undefined;
|
|
6
7
|
playbackSpeedStep?: number | undefined;
|
|
8
|
+
download?: boolean | undefined;
|
|
7
9
|
} & React.RefAttributes<HTMLAudioElement>>;
|
|
8
10
|
//# sourceMappingURL=AudioPlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayer.d.ts","sourceRoot":"","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAC;AA6B5D,eAAO,MAAM,WAAW;SAGf,MAAM
|
|
1
|
+
{"version":3,"file":"AudioPlayer.d.ts","sourceRoot":"","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAC;AA6B5D,eAAO,MAAM,WAAW;SAGf,MAAM;;;;;;0CAmKd,CAAC"}
|
|
@@ -3254,13 +3254,13 @@ function forceDownload(url, fileName) {
|
|
|
3254
3254
|
xhr.send();
|
|
3255
3255
|
}
|
|
3256
3256
|
var AudioPlayer = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (_a, ref) {
|
|
3257
|
-
var src = _a.src, _b = _a.
|
|
3257
|
+
var src = _a.src, _b = _a.type, type = _b === void 0 ? 'audio/mpeg' : _b, _c = _a.maxPlaybackSpeed, maxPlaybackSpeed = _c === void 0 ? 2 : _c, _d = _a.minPlaybackSpeed, minPlaybackSpeed = _d === void 0 ? 0.5 : _d, _e = _a.playbackSpeedStep, playbackSpeedStep = _e === void 0 ? 0.5 : _e, _f = _a.download, download = _f === void 0 ? false : _f;
|
|
3258
3258
|
var audioRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
3259
3259
|
var refs = (0,_rocket_chat_fuselage_hooks__WEBPACK_IMPORTED_MODULE_0__.useMergedRefs)(ref, audioRef);
|
|
3260
|
-
var
|
|
3261
|
-
var
|
|
3262
|
-
var
|
|
3263
|
-
var
|
|
3260
|
+
var _g = __read((0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false), 2), isPlaying = _g[0], setIsPlaying = _g[1];
|
|
3261
|
+
var _h = __read((0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(0), 2), currentTime = _h[0], setCurrentTime = _h[1];
|
|
3262
|
+
var _j = __read((0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(0), 2), durationTime = _j[0], setDurationTime = _j[1];
|
|
3263
|
+
var _k = __read((0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(1), 2), playbackSpeed = _k[0], setPlaybackSpeed = _k[1];
|
|
3264
3264
|
var handlePlay = function () {
|
|
3265
3265
|
var _a, _b, _c;
|
|
3266
3266
|
var isPlaying = (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
|
@@ -3278,7 +3278,7 @@ var AudioPlayer = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (_a
|
|
|
3278
3278
|
};
|
|
3279
3279
|
var handleIncreasePlayBackSpeed = function () { return handlePlaybackSpeed(1); };
|
|
3280
3280
|
var handleDecreasePlayBackSpeed = function () { return handlePlaybackSpeed(-1); };
|
|
3281
|
-
return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.Box, { borderWidth: 'default', borderColor: 'extra-light', p: 'x16', width: 'fit-content', borderRadius: 'x4' },
|
|
3281
|
+
return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.Box, { borderWidth: 'default', bg: 'light', borderColor: 'extra-light', p: 'x16', width: 'fit-content', borderRadius: 'x4' },
|
|
3282
3282
|
react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.Box, { display: 'flex', alignItems: 'center' },
|
|
3283
3283
|
react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.IconButton, { large: true, onClick: handlePlay, icon: isPlaying ? 'pause-unfilled' : 'play-unfilled' }),
|
|
3284
3284
|
react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.Box, { mi: 'x12', position: 'relative' },
|
|
@@ -3297,13 +3297,13 @@ var AudioPlayer = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (_a
|
|
|
3297
3297
|
"x"),
|
|
3298
3298
|
react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.IconButton, { disabled: playbackSpeed >= maxPlaybackSpeed, icon: 'plus', mini: true, onClick: handleIncreasePlayBackSpeed }))),
|
|
3299
3299
|
getMaskTime(durationTime))),
|
|
3300
|
-
react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.IconButton, { is: 'a', href: src, download: true, icon: 'download', large: true, onClick: function (e) {
|
|
3300
|
+
download && (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(___WEBPACK_IMPORTED_MODULE_2__.IconButton, { is: 'a', href: src, download: true, icon: 'download', large: true, onClick: function (e) {
|
|
3301
3301
|
var host = new URL(src).host;
|
|
3302
3302
|
if (host !== window.location.host) {
|
|
3303
3303
|
e.preventDefault();
|
|
3304
3304
|
forceDownload(src);
|
|
3305
3305
|
}
|
|
3306
|
-
} })),
|
|
3306
|
+
} }))),
|
|
3307
3307
|
react__WEBPACK_IMPORTED_MODULE_1___default().createElement("audio", { style: { display: 'none' }, onTimeUpdate: function (e) {
|
|
3308
3308
|
setCurrentTime(e.target.currentTime);
|
|
3309
3309
|
}, onLoadedData: function (e) {
|
|
@@ -3315,7 +3315,7 @@ var AudioPlayer = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (_a
|
|
|
3315
3315
|
}, onPause: function () {
|
|
3316
3316
|
setIsPlaying(false);
|
|
3317
3317
|
}, controls: true },
|
|
3318
|
-
react__WEBPACK_IMPORTED_MODULE_1___default().createElement("source", { src: src, type:
|
|
3318
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().createElement("source", { src: src, type: type }))));
|
|
3319
3319
|
});
|
|
3320
3320
|
|
|
3321
3321
|
|