mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 10:18:31 +02:00
Fix TypeScript lint errors in AudioViewer and VideoViewer
- Change from data.buffer to new Uint8Array(data) to fix ArrayBufferLike type compatibility with Blob constructor - Fixes TS2322 errors about SharedArrayBuffer not being assignable to BlobPart
This commit is contained in:
@@ -13,7 +13,7 @@ export function AudioViewer({ bodyPath, data }: Props) {
|
|||||||
if (bodyPath) {
|
if (bodyPath) {
|
||||||
setSrc(convertFileSrc(bodyPath));
|
setSrc(convertFileSrc(bodyPath));
|
||||||
} else if (data) {
|
} else if (data) {
|
||||||
const blob = new Blob([data], { type: 'audio/mpeg' });
|
const blob = new Blob([new Uint8Array(data)], { type: 'audio/mpeg' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
setSrc(url);
|
setSrc(url);
|
||||||
return () => URL.revokeObjectURL(url);
|
return () => URL.revokeObjectURL(url);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export function VideoViewer({ bodyPath, data }: Props) {
|
|||||||
if (bodyPath) {
|
if (bodyPath) {
|
||||||
setSrc(convertFileSrc(bodyPath));
|
setSrc(convertFileSrc(bodyPath));
|
||||||
} else if (data) {
|
} else if (data) {
|
||||||
const blob = new Blob([data], { type: 'video/mp4' });
|
const blob = new Blob([new Uint8Array(data)], { type: 'video/mp4' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
setSrc(url);
|
setSrc(url);
|
||||||
return () => URL.revokeObjectURL(url);
|
return () => URL.revokeObjectURL(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user