mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 12:43:25 +00:00
18 lines
475 B
TypeScript
18 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;
|
|
}
|