mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-09 08:27:33 +00:00
17 lines
475 B
TypeScript
17 lines
475 B
TypeScript
import { Stream } from '@/providers/streams';
|
|
|
|
export function isValidStream(stream: Stream | undefined): boolean {
|
|
if (!stream) return false;
|
|
if (stream.type === 'hls') {
|
|
if (!stream.playlist) return false;
|
|
return true;
|
|
}
|
|
if (stream.type === 'file') {
|
|
const validQualities = Object.values(stream.qualities).filter((v) => v.url.length > 0);
|
|
if (validQualities.length === 0) return false;
|
|
return true;
|
|
}
|
|
|
|
// unknown file type
|
|
return false;
|
|
}
|