mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-15 17:16:16 -08:00
refactor(chromecast): [PKG-CAST-04] preserve published types and add runtime entry
This commit is contained in:
1 parent
b0cfbfe3a0
commit
8ec9fbe83a
27 files changed
+994
-52
No files matched your search
+43
-13
@@ -1,17 +1,47 @@
|
||||
interface Option {
|
||||
url?: string
|
||||
sdk?: string
|
||||
icon?: string
|
||||
mimeType?: string
|
||||
// Generated from the package public declaration by yarn build:ts. Do not edit.
|
||||
/* eslint-disable ts/no-redeclare -- Callable and public type namespace intentionally merge. */
|
||||
declare namespace artplayerPluginChromecastDefinitions {
|
||||
export interface Option {
|
||||
url?: string
|
||||
sdk?: string
|
||||
icon?: string
|
||||
mimeType?: string
|
||||
}
|
||||
export interface Chromecast {
|
||||
name: 'artplayerPluginChromecast'
|
||||
}
|
||||
/** Published 1.1.0 result; actual registration is asynchronous. */
|
||||
export type Result = Chromecast
|
||||
export type Factory = (option: Option) => (art: Artplayer) => Chromecast
|
||||
export type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'disconnecting'
|
||||
export interface RuntimeOption extends Option {
|
||||
onStateChange?: (this: RuntimeOption, state: ConnectionState) => void
|
||||
onCastAvailable?: (this: RuntimeOption, available: boolean) => void
|
||||
onCastStart?: (this: RuntimeOption) => void
|
||||
onError?: (this: RuntimeOption, error: unknown) => void
|
||||
}
|
||||
export interface RuntimeResult extends Chromecast {
|
||||
/** Last raw SDK SessionState, initially null; not the normalized callback state. */
|
||||
getCastState: () => string | null
|
||||
/** Whether this controller retains a session; does not prove receiver playback. */
|
||||
isCasting: () => boolean
|
||||
}
|
||||
export interface RuntimeFactory {
|
||||
(option: RuntimeOption): (art: Artplayer) => Promise<RuntimeResult>
|
||||
default: RuntimeFactory
|
||||
}
|
||||
export const artplayerPluginChromecast: (option: Option) => (art: Artplayer) => Chromecast
|
||||
}
|
||||
|
||||
interface Chromecast {
|
||||
name: 'artplayerPluginChromecast'
|
||||
declare const artplayerPluginChromecast: typeof artplayerPluginChromecastDefinitions.artplayerPluginChromecast
|
||||
declare namespace artplayerPluginChromecast {
|
||||
export type Option = artplayerPluginChromecastDefinitions.Option
|
||||
export type Chromecast = artplayerPluginChromecastDefinitions.Chromecast
|
||||
export type Result = artplayerPluginChromecastDefinitions.Result
|
||||
export type Factory = artplayerPluginChromecastDefinitions.Factory
|
||||
export type ConnectionState = artplayerPluginChromecastDefinitions.ConnectionState
|
||||
export type RuntimeOption = artplayerPluginChromecastDefinitions.RuntimeOption
|
||||
export type RuntimeResult = artplayerPluginChromecastDefinitions.RuntimeResult
|
||||
export type RuntimeFactory = artplayerPluginChromecastDefinitions.RuntimeFactory
|
||||
}
|
||||
|
||||
declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) => Chromecast
|
||||
|
||||
export default artplayerPluginChromecast
|
||||
|
||||
export = artplayerPluginChromecast
|
||||
export as namespace artplayerPluginChromecast;
|
||||
Reference in new issue
Block a user