Files
yaak/src-web/components/responseViewers/AudioViewer.tsx
2024-05-22 23:14:53 -07:00

19 lines
492 B
TypeScript

import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
import type { HttpResponse } from '../../lib/models';
interface Props {
response: HttpResponse;
}
export function AudioViewer({ response }: Props) {
if (response.bodyPath === null) {
return <div>Empty response body</div>;
}
const src = convertFileSrc(response.bodyPath);
// eslint-disable-next-line jsx-a11y/media-has-caption
return <audio className="w-full" controls src={src}></audio>;
}