Closed Mister-Hope closed 2 months ago
That soft provider type checking was designed for CDN users so TS types are not considered there. You have some options:
Option 1. Use player.provider
which will cast to the correct type:
if (player.provider?.type === 'hls') {
}
Option 2. Cast to AnyMediaProvider
:
import type { AnyMediaProvider } from 'vidstack';
const provider = event.detail as AnyMediaProvider;
if (provider?.type === 'hls') {
}
Option 3. Cast the type yourself:
import type { HLSProvider } from 'vidstack';
if (provider?.type === 'hls') {
const hls = provider as HLSProvider;
}
Hi, you may need to reopen this:
The type is different with docs:
From the docs, VidStack is expecting dash package default import while the types is expecting MediaPlayer
on it.
Please fix one of this.
@mihar-22 reping
See https://www.vidstack.io/docs/wc/player/api/providers/hls?styling=default-theme#loading
The docs says that we can set
library
property onprovider
to change how to load the provider (Background: JSDeliver is nearly inaccessible in China)However, the provider has type
MediaProviderAdapter | null
, and there is no library field onMediaProviderAdapter
: