import { IError, ILogger, ISubject, IValueSubject } from '@vkontakte/videoplayer-shared';
interface IParams {
    appId: string;
    logger: ILogger;
}
export declare class ChromecastPresentationApiConnector {
    protected readonly params: IParams;
    private readonly clientId;
    private readonly capabilities;
    private readonly presentationRequest$;
    private readonly log;
    private readonly sessionId$;
    private readonly broadcastChannel;
    private readonly subscription;
    private subscriptionEvents;
    private isDestroyed;
    private sequenceNumber;
    readonly presentationAvailable$: IValueSubject<boolean>;
    readonly presentationConnection$: IValueSubject<PresentationConnection | null>;
    readonly message$: IValueSubject<PresentationConnectionMessages | null>;
    readonly friendlyName$: IValueSubject<string | null>;
    readonly errorEvent$: ISubject<IError>;
    constructor(params: IParams);
    destroy(): void;
    /**
     * в случае перехвата соединения другим плеером важно не останавливать медийку,
     * иначе прервется кастинг у того плеера, который его запустил
     */
    disconnect(withStopMedia?: boolean): void;
    /**
     * нужно вызывать перед `disconnect`, потому что если хромкаст был инициализирован на чужом соединении
     * (те успешно сработал `presentationRequest.reconnect('auto-join')`), то `presentationConnection.close()`
     * не отключит медийку на девайсе, если до этого оно не стояло на `PAUSE` или `STOP` (сделал через `STOP`,
     * в итоге, для обратной совместимости с обвязкой для гуглового сдк)
     */
    stopMedia(): void;
    /**
     * @param reconnect включает попытку восстановить соединение через `.reconnect('auto-join')`
     */
    private reinitPresentation;
    /** должен быть инициализирован с user-input'ом */
    connect(): Promise<void>;
    private subscribe;
    private send;
    sendV2Message(message: object): void;
    private safeSend;
    private handleMessage;
    private createCastUrl;
    private getSequenceNumber;
    private resetSequenceNumber;
    private getClientId;
    private resetSubscriptionEvents;
    private handleConnection;
}
declare global {
    interface Window {
        __vk_player_chromecast_id?: string;
    }
    interface Navigator {
        presentation: {
            defaultRequest: PresentationRequest | null;
        };
    }
    type PresentationUrls = string | string[];
    type PresentationConnectionState = 'connecting' | 'connected' | 'closed' | 'terminated';
    class PresentationRequest extends EventTarget {
        constructor(presentationUrls: PresentationUrls | undefined);
        start(): Promise<PresentationConnection>;
        reconnect(presentationId: string): Promise<PresentationConnection>;
        getAvailability(): Promise<PresentationAvailability>;
        onconnectionavailable: ((this: PresentationRequest, ev: PresentationConnectionAvailableEvent) => void) | null;
    }
    class PresentationConnection extends EventTarget {
        readonly id: string;
        readonly state: PresentationConnectionState;
        onclose: ((this: PresentationConnection, ev: PresentationConnectionCloseEvent) => void) | null;
        onconnect: ((this: PresentationConnection) => void) | null;
        onmessage: ((this: PresentationConnection, ev: PresentationConnectionMessageEvent) => void) | null;
        onterminate: ((this: PresentationConnection) => void) | null;
        send: (data: string) => void;
        terminate: () => void;
        close: () => void;
    }
    interface PresentationAvailability extends EventTarget {
        value: boolean;
        onchange: ((this: PresentationAvailability, ev: Event) => void) | null;
    }
    interface PresentationConnectionAvailableEvent extends Event {
        readonly connection: PresentationConnection;
    }
    interface PresentationConnectionCloseEvent extends Event {
        readonly reason: 'closed' | 'error';
    }
    interface PresentationConnectionMessageEvent extends Event {
        readonly data: string;
    }
}
interface PresentationConnectionMessage {
    clientId: string;
    timeoutMillis: number;
}
interface PresentationConnectionMessageReceiverAction extends PresentationConnectionMessage {
    type: 'receiver_action';
    message: {
        action: 'cast' | 'stop';
        receiver: chrome.cast.Receiver;
    };
}
interface PresentationConnectionMessageSession extends PresentationConnectionMessage {
    type: 'new_session' | 'update_session';
    message: chrome.cast.Session;
}
interface PresentationConnectionMessageV2Message extends PresentationConnectionMessage {
    type: 'v2_message';
    message: PresentationConnectionMessageV2MessageMessage;
}
interface PresentationConnectionMessageV2MessageMessage {
    type: 'MEDIA_STATUS';
    requestId: number;
    sessionId: string;
    status: chrome.cast.media.Media[];
}
export type PresentationConnectionMessages = PresentationConnectionMessageReceiverAction | PresentationConnectionMessageSession | PresentationConnectionMessageV2Message;
export {};
