Skip to content

Commit 264d497

Browse files
authored
TS typings fixes
1 parent 1a32c28 commit 264d497

File tree

1 file changed

+42
-26
lines changed

1 file changed

+42
-26
lines changed

index.d.ts

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import React from 'react';
22
import {WebViewProps} from 'react-native-webview';
3+
import {StyleProp, ViewStyle} from 'react-native';
34

45
export interface InitialPlayerParams {
5-
loop: boolean;
6-
controls: boolean;
7-
cc_lang_pref: string;
8-
showClosedCaptions: boolean;
9-
color: string;
10-
start: Number;
11-
end: Number;
12-
preventFullScreen: boolean;
13-
playerLang: String;
14-
iv_load_policy: Number;
15-
modestbranding: boolean;
16-
rel: boolean;
6+
loop?: boolean;
7+
controls?: boolean;
8+
cc_lang_pref?: string;
9+
showClosedCaptions?: boolean;
10+
color?: string;
11+
start?: Number;
12+
end?: Number;
13+
preventFullScreen?: boolean;
14+
playerLang?: String;
15+
iv_load_policy?: Number;
16+
modestbranding?: boolean;
17+
rel?: boolean;
1718
}
1819

1920
export interface YoutubeIframeProps {
@@ -42,65 +43,80 @@ export interface YoutubeIframeProps {
4243
* @example
4344
* playList={['QRt7LjqJ45k', 'fHsa9DqmId8']}
4445
*/
45-
playList: Array<String> | String;
46+
playList?: Array<String> | String;
4647
/**
4748
* Flag to tell the player to play or pause the video.
4849
*/
49-
play: Boolean;
50+
play?: Boolean;
5051

5152
/**
5253
* Flag to tell the player to mute the video.
5354
*/
54-
mute: Boolean;
55+
mute?: Boolean;
5556
/**
5657
* Sets the volume. Accepts an integer between `0` and `100`.
5758
*/
58-
volume: Number;
59+
volume?: Number;
5960
/**
6061
* A style prop that will be given to the webview
6162
*/
62-
webViewStyle: any;
63+
webViewStyle?: StyleProp<ViewStyle>;
6364
/**
6465
* 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)
6566
*/
66-
webViewProps: WebViewProps;
67+
webViewProps?: WebViewProps;
6768
/**
6869
* 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.
6970
*/
70-
playbackRate: Number;
71+
playbackRate?: Number;
7172
/**
7273
* This event fires if an error occurs in the player. The API will pass an error string to the event listener function.
7374
*/
74-
onError: (error: string) => void;
75+
onError?: (error: string) => void;
7576
/**
7677
* This event fires whenever a player has finished loading and is ready.
7778
*/
78-
onReady: () => void;
79+
onReady?: () => void;
7980
/**
8081
* Starts the playlist from the given index
8182
*
8283
* Works only if the playlist is a list of video IDs.
8384
*/
84-
playListStartIndex: Number;
85+
playListStartIndex?: Number;
8586
initialPlayerParams: InitialPlayerParams;
8687
/**
8788
* Changes user string to make autoplay work on the iframe player for some android devices.
8889
*/
89-
forceAndroidAutoplay: Boolean;
90+
forceAndroidAutoplay?: Boolean;
9091
/**
9192
* callback for when the player's state changes.
9293
*/
93-
onChangeState: (event: String) => void;
94+
onChangeState?: (event: String) => void;
9495
/**
9596
* callback for when the video playback quality changes. It might signal a change in the viewer's playback environment.
9697
*/
97-
onPlaybackQualityChange: (quality: String) => void;
98+
onPlaybackQualityChange?: (quality: String) => void;
9899
/**
99100
* callback for when the video playback rate changes.
100101
*/
101-
onPlaybackRateChange: (event: String) => void;
102+
onPlaybackRateChange?: (event: String) => void;
102103
}
103104

104105
declare const YoutubeIframe: React.SFC<YoutubeIframeProps>;
105106

106107
export default YoutubeIframe;
108+
109+
export function getYoutubeMeta (id: string): {
110+
"thumbnail_width": number,
111+
"type": string,
112+
"html": string,
113+
"height": number,
114+
"author_name": string,
115+
"width": number,
116+
"title": string,
117+
"author_url": string,
118+
"version": string,
119+
"thumbnail_height": number,
120+
"provider_url": string,
121+
"thumbnail_url": string,
122+
};

0 commit comments

Comments
 (0)