forked from LonelyCpp/react-native-youtube-iframe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
126 lines (120 loc) · 3.91 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import React from 'react';
import {StyleProp, ViewStyle} from 'react-native';
import {WebViewProps} from 'react-native-webview';
export interface InitialPlayerParams {
loop?: boolean;
controls?: boolean;
cc_lang_pref?: string;
showClosedCaptions?: boolean;
color?: string;
start?: Number;
end?: Number;
preventFullScreen?: boolean;
playerLang?: String;
iv_load_policy?: Number;
modestbranding?: boolean;
rel?: boolean;
}
export interface YoutubeIframeProps {
/**
* height of the webview container
*
* Note: Embedded players must have a viewport that is at least 200px by 200px. If the player displays controls, it must be large enough to fully display the controls without shrinking the viewport below the minimum size. We recommend 16:9 players be at least 480 pixels wide and 270 pixels tall.
*/
height: Number;
/**
* width of the webview container
*
* Note: Embedded players must have a viewport that is at least 200px by 200px. If the player displays controls, it must be large enough to fully display the controls without shrinking the viewport below the minimum size. We recommend 16:9 players be at least 480 pixels wide and 270 pixels tall.
*/
width?: Number;
/**
* Specifies the YouTube Video ID of the video to be played.
*/
videoId: String;
/**
* Specifies the playlist to play. It can be either the playlist ID or a list of video IDs
*
* @example
* playList={'PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb'}
*
* @example
* playList={['QRt7LjqJ45k', 'fHsa9DqmId8']}
*/
playList?: Array<String> | String;
/**
* Flag to tell the player to play or pause the video.
*/
play?: Boolean;
/**
* Flag to tell the player to mute the video.
*/
mute?: Boolean;
/**
* Sets the volume. Accepts an integer between `0` and `100`.
*/
volume?: Number;
/**
* A style prop that will be given to the webview
*/
webViewStyle?: StyleProp<ViewStyle>;
/**
* Props that are supplied to the underlying webview (react-native-webview). A full list of props can be found [here](https://github.com/react-native-community/react-native-webview/blob/master/docs/Reference.md#props-index)
*/
webViewProps?: WebViewProps;
/**
* This sets the suggested playback rate for the current video. If the playback rate changes, it will only change for the video that is already cued or being played.
*/
playbackRate?: Number;
/**
* This event fires if an error occurs in the player. The API will pass an error string to the event listener function.
*/
onError?: (error: string) => void;
/**
* This event fires whenever a player has finished loading and is ready.
*/
onReady?: () => void;
/**
* Starts the playlist from the given index
*
* Works only if the playlist is a list of video IDs.
*/
playListStartIndex?: Number;
initialPlayerParams: InitialPlayerParams;
/**
* Changes user string to make autoplay work on the iframe player for some android devices.
*/
forceAndroidAutoplay?: Boolean;
/**
* callback for when the player's state changes.
*/
onChangeState?: (event: String) => void;
/**
* callback for when the video playback quality changes. It might signal a change in the viewer's playback environment.
*/
onPlaybackQualityChange?: (quality: String) => void;
/**
* callback for when the video playback rate changes.
*/
onPlaybackRateChange?: (event: String) => void;
/**
* Flag to decide whether or not a user can zoom the video webview.
*/
allowWebViewZoom?: Boolean;
}
declare const YoutubeIframe: React.SFC<YoutubeIframeProps>;
export default YoutubeIframe;
export function getYoutubeMeta (id: string): {
"thumbnail_width": number,
"type": string,
"html": string,
"height": number,
"author_name": string,
"width": number,
"title": string,
"author_url": string,
"version": string,
"thumbnail_height": number,
"provider_url": string,
"thumbnail_url": string,
};