import { IApp, IEpisodeQuery, IEpisodeQueryResult, IPlayableOptions, IPlayerChannel, IPlayerEnabledConstructor, IQueryResult, IRecommendationQuery, OptionsFor, Opts } from "./app"; import { ChromecastDevice } from "./device"; declare type IAppOf = T extends IPlayerEnabledConstructor ? TApp : never; interface IConfiguredApp> { appConstructor: TConstructor; channel: IPlayerChannel>; options: OptionsFor; autoConfigure?: boolean; } export declare type AppSpecificErrorHandler = (app: string, e: Error) => void; export interface IQueryOptions { /** * Handler for when an app encounters an error. By default, the error will * just be thrown eagerly, but you may prefer to simply log the error and allow * the other apps to provide their results */ onError?: AppSpecificErrorHandler; } declare type QueryOptions = AppSpecificErrorHandler | IQueryOptions; export interface IPlayerOpts { /** * If true (the default) each device will be closed * automatically after each Player method call. Set * to false if you want to keep the connection alive. */ autoClose?: boolean; } export declare class Player { private apps; private devices; private opts; constructor(apps: Array>>, devices: ChromecastDevice[], opts: IPlayerOpts); buildUpon(): PlayerBuilder; playUrl(url: string, opts?: IPlayableOptions): Promise; play(result: IQueryResult, opts?: IPlayableOptions): Promise; findEpisodeFor(item: IQueryResult, query: IEpisodeQuery): Promise; /** * Get an AsyncIterable representing playables from across all * configured apps. Each result can be passed directly to `play`. * * @param title The title to search for */ queryByTitle(title: string, options?: QueryOptions): AsyncIterable; /** * Get an AsyncIterable representing playables from across all * configured apps. Each result can be passed directly to `play`. * Returned IQueryResult instances represent a specific episode * in a Series that matches the given title * * @param title The title to search for * @param query A description of the desired episode to play */ queryEpisodeForTitle(title: string, query: IEpisodeQuery, options?: QueryOptions): AsyncIterable; /** * Get a map where each key is the name of an App and each value is an * AsyncIterable representing recommended media from that app. Each result * can be passed directly to `play`. * @deprecated Use getQueryRecommendationsMap instead. */ getRecommendationsMap(options?: QueryOptions): { [app: string]: AsyncIterable; }; /** * Get an AsyncIterable representing playables from across all * configured apps. Each result can be passed directly to `play`. * @deprecated */ queryRecommended(options?: QueryOptions): AsyncIterable; private getDeprecatedRecommendationsMap; /** * Get a map where each key is the name of an App and each value is an * AsyncIterable representing recommended media from that app. Each result * can be passed directly to `play`. * @see [IPlayerChannel.queryRecommendations] */ getQueryRecommendationsMap(query?: IRecommendationQuery, options?: QueryOptions): { [app: string]: AsyncIterable; }; /** * Get an AsyncIterable representing playables from across all * configured apps. Each result can be passed directly to `play`. */ queryRecommendations(query?: IRecommendationQuery, options?: QueryOptions): AsyncIterable; /** * Get a map each key is the name of an App and each value is an * AsyncIterable representing recently-watched media from that app. Each result * can be passed directly to `play`. */ getRecentsMap(options?: QueryOptions): { [app: string]: AsyncIterable; }; /** * Get an AsyncIterable representing playables from across all * configured apps. Each result can be passed directly to `play`. */ queryRecents(options?: QueryOptions): AsyncIterable; private buildQueryMap; private playOnEachDevice; private withEachDevice; } export declare type QueryOnlyPlayer = Omit; export declare class PlayerBuilder { private readonly apps; private readonly devices; private opts; static autoInflate(configPath?: string): Promise; constructor(apps?: Array>, devices?: ChromecastDevice[], opts?: IPlayerOpts); withApp>(appConstructor: TConstructor, ...options: OptionsFor): this; addDevice(device: ChromecastDevice): this; configure(opts: IPlayerOpts): this; /** * Create a new PlayerBuilder instance with the same initial config as this PlayerBuilder */ clone(): PlayerBuilder; /** * Build a Player instance that does not support playback methods */ buildQueryOnly(): QueryOnlyPlayer; build(): Player; private buildInternal; } export {};