/** * @typedef {Object} mep_niconico_load_object * @property {string} videoId - The ID of the video. * @property {number} [startSeconds] - The start time of the video. * @property {number} [endSeconds] - The end time of the video. */ interface mep_niconico_load_object { videoId: string; startSeconds?: number; endSeconds?: number; } /** * @typedef {Object} mep_niconico_playerVars * @property {number} [startSeconds] - The start time of the video. * @property {number} [endSeconds] - The end time of the video. * @property {number} [autoplay] - Whether the video is on autoplay. * @property {number} [displayComment] - Whether the video is on display comment mode. */ interface mep_niconico_playerVars { startSeconds?: number; endSeconds?: number; autoplay?: number; displayComment?: number; } /** * @typedef {Object} mep_niconico_content * @property {string} videoId - The ID of the video. * @property {number} width - The width of the player. * @property {number} height - The height of the player. * @property {mep_niconico_playerVars} playerVars - The player variables. */ interface NiconicoPlayerState { isRepeat: boolean; playerStatus: number; currentTime?: number; duration?: number; muted?: boolean; volume?: number; videoInfo?: { title?: string; }; } interface mep_niconico_content { videoId: string; width: number; height: number; playerVars?: mep_niconico_playerVars; } interface NiconicoPlayMessage { eventName: 'play'; } interface NiconicoPauseMessage { eventName: 'pause'; } interface NiconicoSeekMessage { eventName: 'seek'; data: { time: number; }; } interface NiconicoCommentVisibilityMessage { eventName: 'commentVisibilityChange'; data: { commentVisibility: boolean; }; } interface NiconicoMuteMessage { eventName: 'mute'; data: { mute: boolean; }; } interface NiconicoVolumeMessage { eventName: 'volumeChange'; data: { volume: number; }; } type NiconicoPostMessage = NiconicoPlayMessage | NiconicoPauseMessage | NiconicoSeekMessage | NiconicoCommentVisibilityMessage | NiconicoMuteMessage | NiconicoVolumeMessage; /** * Class representing a Niconico player. */ declare class mep_niconico { #private; state: NiconicoPlayerState; startSeconds: number; player: HTMLIFrameElement; playerId: string; autoplay_flag: boolean; endSeconds: number; displayCommentMode: boolean | undefined; /** * The ID of the player. * @type {number} */ static playerId: number; /** * The origin of the Niconico player. * @type {string} */ static origin: string; /** * The result of checking local storage. * @type {boolean} */ static localStorageCheck: boolean | null; /** * Create a Niconico player. * @param {string|HTMLElement} replacing_element - The element to replace with the player. * @param {Object} content - The content of the player. * @param {Function} player_set_event_function - The function to set player events. */ constructor(replacing_element: string | HTMLElement, content: mep_niconico_content, player_set_event_function?: (player: HTMLIFrameElement) => void); /** * Cue a video by ID. * @param {mep_niconico_load_object} content - The content of the video. */ cueVideoById(content: mep_niconico_load_object): void; /** * Load a video by ID. * @param {mep_niconico_load_object} content - The content of the video. */ loadVideoById(content: mep_niconico_load_object): void; /** * Get the real duration of the video. * @returns {number} The duration of the video. */ getRealDulation(): number; /** * Play the video. */ playVideo(): void; /** * Pause the video. */ pauseVideo(): void; /** * Get the current time of the video. * @returns {number} The current time of the video. */ getCurrentTime(): number; /** * Get the duration of the video. * @returns {number} The duration of the video. */ getDuration(): number; /** * Get the title of the video. * @returns {string} The title of the video. */ getTitle(): string; /** * Check if the video is muted. * @returns {boolean} Whether the video is muted. */ isMuted(): boolean; /** * Get the volume of the video. * @returns {number} The volume of the video. */ getVolume(): number; /** * Seek to a specific time in the video. * @param {number} seconds - The time to seek to. */ seekTo(seconds: number): void; /** * Change the display comment mode of the video. * @param {boolean} mode - The display comment mode to set. */ displayComment(mode: boolean): void; /** * Mute the video. */ mute(): void; /** * Unmute the video. */ unMute(): void; /** * Set the volume of the video. * @param {number} volume - The volume to set. */ setVolume(volume: number): void; /** * Get the state of the player. * @returns {number} The state of the player. */ getPlayerState(): number; } //# sourceMappingURL=niconico.d.ts.map