fix:format file audio in audio detail download
This commit is contained in:
parent
0e166f6dd9
commit
34e8670983
|
|
@ -247,7 +247,17 @@ const DetailAudio = () => {
|
|||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
const contentType =
|
||||
xhr.getResponseHeader("content-type") || "application/octet-stream";
|
||||
const extension = contentType.split("/")[1];
|
||||
let extension = contentType.split("/")[1];
|
||||
|
||||
if (selectedSize === "MP3") {
|
||||
extension = "mp3";
|
||||
}
|
||||
|
||||
if (selectedSize === "WAV") {
|
||||
extension = "wav";
|
||||
}
|
||||
|
||||
|
||||
const filename = `${name}.${extension}`;
|
||||
|
||||
const blob = new Blob([xhr.response], {
|
||||
|
|
@ -403,7 +413,7 @@ const DetailAudio = () => {
|
|||
const { default: WaveSurfer } = await import("wavesurfer.js");
|
||||
|
||||
if (wavesurfer.current) {
|
||||
wavesurfer.current.destroy();
|
||||
wavesurfer.current.destroy();
|
||||
}
|
||||
|
||||
setPlaying(false);
|
||||
|
|
@ -443,7 +453,7 @@ const DetailAudio = () => {
|
|||
|
||||
return () => {
|
||||
if (wavesurfer.current) {
|
||||
wavesurfer.current.destroy();
|
||||
wavesurfer.current.destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue