import { ReactiveElement } from 'lit'; import { LogDispatcher } from '../logger'; import { ScreenOrientationController, ScreenOrientationLock } from '../screen-orientation'; import { DisposalBin } from '../utils/events'; export declare type FullscreenControllerHost = ReactiveElement & { requestFullscreen(): Promise; exitFullscreen(): Promise; }; /** * Unfortunately fullscreen isn't straight forward due to cross-browser inconsistencies. This * class abstract the logic for handling fullscreen across browsers. * * @example * ```ts * import { LitElement } from 'lit'; * import { FullscreenController, ScreenOrientationController } from '@vidstack/player'; * * class MyElement extends LitElement { * fullscreenController = new FullscreenController( * this, * new ScreenOrientationController(this), * ); * * requestFullscreen() { * if (this.fullscreenController.isRequestingNativeFullscreen) { * return super.requestFullscreen(); * } * * return this.fullscreenController.requestFullscreen(); * } * * exitFullscreen() { * return this.fullscreenController.exitFullscreen(); * } * } * ``` */ export declare class FullscreenController { protected readonly _host: FullscreenControllerHost; protected readonly _screenOrientationController: ScreenOrientationController; protected readonly _listenerDisposal: DisposalBin; protected readonly _logger: LogDispatcher | undefined; /** * Used to avoid an infinite loop by indicating when the native `requestFullscreen()` method * is being called. * * Bad Call Stack: host.requestFullscreen() -> controller.requestFullscreen() -> * fscreen.requestFullscreen() -> controller.requestFullscreen() -> fscreen.requestFullscreen() ... * * Good Call Stack: host.requestFullscreen() -> controller.requestFullscreen() -> fscreen.requestFullscreen() * -> (native request fullscreen method on host) */ isRequestingNativeFullscreen: boolean; /** * This will indicate the orientation to lock the screen to when in fullscreen mode. The default * is `undefined` which indicates no screen orientation change. */ screenOrientationLock?: ScreenOrientationLock; constructor(_host: FullscreenControllerHost, _screenOrientationController: ScreenOrientationController); /** * Dispose of any event listeners and exit fullscreen (if active). */ protected _handleHostDisconnected(): Promise; /** * Whether fullscreen mode can be requested, generally is an API available to do so. */ get isSupported(): boolean; /** * Whether the native Fullscreen API is enabled/available. */ get isSupportedNatively(): boolean; /** * Whether the host element is in fullscreen mode. */ get isFullscreen(): boolean; /** * Whether the host element is in fullscreen mode via the native Fullscreen API. */ get isNativeFullscreen(): boolean; /** * @param listener * @returns Stop listening function. */ protected _addFullscreenChangeEventListener(listener: (this: HTMLElement, event: Event) => void): () => void; /** * @param listener * @returns Stop listening function. */ protected _addFullscreenErrorEventListener(listener: (this: HTMLElement, event: Event) => void): () => void; requestFullscreen(): Promise; protected _makeEnterFullscreenRequest(): Promise; protected _handleFullscreenChange(event: Event): void; protected _handleFullscreenError(event: Event): void; exitFullscreen(): Promise; protected _makeExitFullscreenRequest(): Promise; protected _shouldOrientScreen(): boolean; protected _lockScreenOrientation(): Promise; protected _unlockScreenOrientation(): Promise; /** * @throws {Error} - Will throw if Fullscreen API is not enabled or supported. */ protected _throwIfNoFullscreenSupport(): void; } //# sourceMappingURL=FullscreenController.d.ts.map