@rocket.chat/fuselage 0.32.0-dev.432 → 0.32.0-dev.433
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayer.d.ts","sourceRoot":"","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AudioPlayer.d.ts","sourceRoot":"","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAuD5D,eAAO,MAAM,WAAW;SAGf,MAAM;;;;;;;;;;;0CAsKd,CAAC"}
|
|
@@ -998,6 +998,25 @@ function forceDownload(url, fileName) {
|
|
|
998
998
|
};
|
|
999
999
|
xhr.send();
|
|
1000
1000
|
}
|
|
1001
|
+
var getDurationForInfinityDurationAudioFile = function (src, callback) {
|
|
1002
|
+
var audioElement = new Audio();
|
|
1003
|
+
audioElement.src = src;
|
|
1004
|
+
audioElement.addEventListener('loadedmetadata', function () {
|
|
1005
|
+
var duration = audioElement.duration;
|
|
1006
|
+
if (duration === Infinity) {
|
|
1007
|
+
audioElement.currentTime = 1e101;
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
return callback(duration);
|
|
1011
|
+
});
|
|
1012
|
+
audioElement.addEventListener('durationchange', function () {
|
|
1013
|
+
if (audioElement.duration === Infinity) {
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
callback(audioElement.duration);
|
|
1017
|
+
audioElement.remove();
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1001
1020
|
exports.AudioPlayer = (0, react_1.forwardRef)(function (_a, ref) {
|
|
1002
1021
|
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.25 : _e, _f = _a.download, download = _f === void 0 ? false : _f, _g = _a.playLabel, playLabel = _g === void 0 ? 'Play' : _g, _h = _a.pauseLabel, pauseLabel = _h === void 0 ? 'Pause' : _h, _j = _a.audioPlaybackRangeLabel, audioPlaybackRangeLabel = _j === void 0 ? 'Audio Playback Range' : _j, _k = _a.changePlaybackSpeedLabel, changePlaybackSpeedLabel = _k === void 0 ? 'Change Playback Speed' : _k, _l = _a.downloadAudioFileLabel, downloadAudioFileLabel = _l === void 0 ? 'Download Audio File' : _l;
|
|
1003
1022
|
var audioRef = (0, react_1.useRef)(null);
|
|
@@ -1055,8 +1074,12 @@ exports.AudioPlayer = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1055
1074
|
} })),
|
|
1056
1075
|
react_1.default.createElement("audio", { style: { display: 'none' }, onTimeUpdate: function (e) {
|
|
1057
1076
|
setCurrentTime(e.target.currentTime);
|
|
1058
|
-
},
|
|
1059
|
-
|
|
1077
|
+
}, onLoadedMetadata: function (e) {
|
|
1078
|
+
var duration = e.target.duration;
|
|
1079
|
+
if (duration !== Infinity) {
|
|
1080
|
+
return setDurationTime(duration);
|
|
1081
|
+
}
|
|
1082
|
+
getDurationForInfinityDurationAudioFile(src, setDurationTime);
|
|
1060
1083
|
}, onEnded: function () { return setIsPlaying(false); }, ref: refs, preload: 'metadata', onRateChange: function (e) {
|
|
1061
1084
|
setPlaybackSpeed(e.target.playbackRate);
|
|
1062
1085
|
}, onPlay: function () {
|