capacitor-youtube-player
Version:
Capacitor Youtube Player
292 lines (291 loc) • 7.88 kB
TypeScript
import { WebPlugin } from '@capacitor/core';
import type { YoutubePlayerPlugin } from './definitions';
import type { IPlayerSize, IPlayerState, IPlayerOptions, RequiredKeys, IPlaylistOptions, IPlaybackQuality, IVideoOptionsById, IVideoOptionsByUrl, Events, PlayerEvent } from './web/models/models';
export declare function YT(): any;
export declare function Player(): any;
export declare function PlayerState(): any;
export declare class YoutubePlayerPluginWeb extends WebPlugin implements YoutubePlayerPlugin {
players: any;
playersEventsState: Map<string, IPlayerState>;
player: any;
playerApiLoaded: boolean;
private readonly defaultSizes;
playerLogger: any;
constructor();
loadPlayerApi(): Promise<boolean>;
checkSize(options: IPlayerOptions): IPlayerSize;
createPlayer(options: RequiredKeys<IPlayerOptions, 'playerId'>): Promise<{
playerReady: boolean;
player: string;
}>;
initialize(options: RequiredKeys<IPlayerOptions, 'playerId'>): Promise<{
playerReady: boolean;
player: string;
} | undefined>;
destroy(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
/*********/
stopVideo(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
playVideo(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
pauseVideo(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
seekTo(playerId: string, seconds: number, allowSeekAhead: boolean): Promise<{
result: {
method: string;
value: boolean;
seconds: number;
allowSeekAhead: boolean;
};
}>;
loadVideoById(playerId: string, options: IVideoOptionsById): Promise<{
result: {
method: string;
value: boolean;
options: IVideoOptionsById;
};
}>;
cueVideoById(playerId: string, options: IVideoOptionsById): Promise<{
result: {
method: string;
value: boolean;
options: IVideoOptionsById;
};
}>;
loadVideoByUrl(playerId: string, options: IVideoOptionsByUrl): Promise<{
result: {
method: string;
value: boolean;
options: IVideoOptionsByUrl;
};
}>;
cueVideoByUrl(playerId: string, options: IVideoOptionsByUrl): Promise<{
result: {
method: string;
value: boolean;
options: IVideoOptionsByUrl;
};
}>;
/*********/
/*********/
cuePlaylist(playerId: string, playlistOptions: IPlaylistOptions): Promise<{
result: {
method: string;
value: boolean;
};
}>;
loadPlaylist(playerId: string, playlistOptions: IPlaylistOptions): Promise<{
result: {
method: string;
value: boolean;
};
}>;
/*********/
/*********/
nextVideo(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
previousVideo(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
playVideoAt(playerId: string, index: number): Promise<{
result: {
method: string;
value: boolean;
};
}>;
/*********/
getPlaybackRate(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
setPlaybackRate(playerId: string, rate: number): Promise<{
result: {
method: string;
value: boolean;
};
}>;
getAvailablePlaybackRates(playerId: string): Promise<{
result: {
method: string;
value: number[];
};
}>;
/*********/
/*********/
/*********/
setLoop(playerId: string, loop: boolean): Promise<{
result: {
method: string;
value: boolean;
};
}>;
setShuffle(playerId: string, shuffle: boolean): Promise<{
result: {
method: string;
value: boolean;
};
}>;
/*********/
/*********/
mute(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
unMute(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
isMuted(playerId: string): Promise<{
result: {
method: string;
value: boolean;
};
}>;
setVolume(playerId: string, volume: number): Promise<{
result: {
method: string;
value: number;
};
}>;
getVolume(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
/*********/
/*********/
setSize(playerId: string, width: number, height: number): Promise<{
result: {
method: string;
value: IPlayerSize;
};
}>;
/*********/
/*********/
getVideoLoadedFraction(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
getPlayerState(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
getAllPlayersEventsState(): Promise<{
result: {
method: string;
value: Map<string, IPlayerState>;
};
}>;
getCurrentTime(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
toggleFullScreen(playerId: string, isFullScreen: boolean | null | undefined): Promise<{
result: {
method: string;
value: boolean | null | undefined;
};
}>;
/*********/
/*********/
getPlaybackQuality(playerId: string): Promise<{
result: {
method: string;
value: IPlaybackQuality;
};
}>;
setPlaybackQuality(playerId: string, playbackQuality: IPlaybackQuality): Promise<{
result: {
method: string;
value: boolean;
};
}>;
getAvailableQualityLevels(playerId: string): Promise<{
result: {
method: string;
value: IPlaybackQuality[];
};
}>;
/*********/
/*********/
getDuration(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
getVideoUrl(playerId: string): Promise<{
result: {
method: string;
value: string;
};
}>;
getVideoEmbedCode(playerId: string): Promise<{
result: {
method: string;
value: string;
};
}>;
/*********/
/*********/
getPlaylist(playerId: string): Promise<{
result: {
method: string;
value: string[];
};
}>;
getPlaylistIndex(playerId: string): Promise<{
result: {
method: string;
value: number;
};
}>;
/*********/
/*********/
getIframe(playerId: string): Promise<{
result: {
method: string;
value: HTMLIFrameElement;
};
}>;
/*********/
addEventListener<TEvent extends PlayerEvent>(playerId: string, eventName: keyof Events, listener: (event: TEvent) => void): void;
removeEventListener<TEvent extends PlayerEvent>(playerId: string, eventName: keyof Events, listener: (event: TEvent) => void): void;
}