Skip to content

Commit 424e4a5

Browse files
committed
update readme and fix youtubeMeta type
1 parent a6f895f commit 424e4a5

File tree

3 files changed

+19
-103
lines changed

3 files changed

+19
-103
lines changed

index.d.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,23 @@ export interface YoutubeIframeProps {
124124
ref?: React.MutableRefObject<YoutubeIframeRef | null>;
125125
}
126126

127+
export interface YoutubeMeta {
128+
thumbnail_width: number;
129+
type: string;
130+
html: string;
131+
height: number;
132+
author_name: string;
133+
width: number;
134+
title: string;
135+
author_url: string;
136+
version: string;
137+
thumbnail_height: number;
138+
provider_url: string;
139+
thumbnail_url: string;
140+
}
141+
127142
declare const YoutubeIframe: React.SFC<YoutubeIframeProps>;
128143

129144
export default YoutubeIframe;
130145

131-
export function getYoutubeMeta (id: string): {
132-
"thumbnail_width": number,
133-
"type": string,
134-
"html": string,
135-
"height": number,
136-
"author_name": string,
137-
"width": number,
138-
"title": string,
139-
"author_url": string,
140-
"version": string,
141-
"thumbnail_height": number,
142-
"provider_url": string,
143-
"thumbnail_url": string,
144-
};
146+
export function getYoutubeMeta(id: string): Promise<YoutubeMeta>;

readme.md

Lines changed: 3 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -13,97 +13,11 @@ A wrapper of the Youtube IFrame player API build for react native.
1313
- ✅ Works on modals and overlay components
1414
- ✅ Expo support
1515

16-
![ios](./doc/demo.gif?raw=true 'ios')
16+
![ios](./website/static/img/demo.gif?raw=true 'ios')
1717

18-
## Prerequisite
18+
## Installation and Documentation
1919

20-
This package uses react-hooks and therefore will need **react-native `0.59` or above**
21-
22-
(recommended - react native version - `0.60` or above)
23-
24-
## Installation
25-
26-
1. First install `react-native-webview`.
27-
28-
- Bare React Native app - [Instructions](https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md)
29-
30-
- React Native version **`0.60` and above**, install the latest version of react-native-webview
31-
- React Native version **below `0.60`**, react-native-webview version `6.11.1` is the last version that supports it.
32-
33-
- Expo Managed App - [Instructions](https://docs.expo.io/versions/latest/sdk/webview/)
34-
35-
2. Run - `npm install react-native-youtube-iframe`
36-
37-
## Usage
38-
39-
```js
40-
import React, {useRef, useState} from 'react';
41-
import YoutubePlayer from 'react-native-youtube-iframe';
42-
43-
const playerRef = useRef(null);
44-
const [playing, setPlaying] = useState(true);
45-
```
46-
47-
```JSX
48-
<YoutubePlayer
49-
ref={playerRef}
50-
height={300}
51-
width={400}
52-
videoId={"AVAc1gYLZK0"}
53-
play={playing}
54-
onChangeState={event => console.log(event)}
55-
onReady={() => console.log("ready")}
56-
onError={e => console.log(e)}
57-
onFullScreenChange={status => console.log(status)}
58-
onPlaybackQualityChange={q => console.log(q)}
59-
volume={50}
60-
playbackRate={1}
61-
initialPlayerParams={{
62-
cc_lang_pref: "us",
63-
showClosedCaptions: true
64-
}}
65-
/>
66-
```
67-
68-
## API reference
69-
70-
**[Click here for full reference](./doc)**
71-
72-
list of available APIs -
73-
74-
### props
75-
76-
- videoId
77-
- playList
78-
- playListStartIndex
79-
- play
80-
- onChangeState
81-
- onReady
82-
- onError
83-
- onFullScreenChange
84-
- onPlaybackQualityChange
85-
- mute
86-
- volume
87-
- playbackRate
88-
- onPlaybackRateChange
89-
- initialPlayerParams
90-
- webViewStyle
91-
- webViewProps
92-
- allowWebViewZoom
93-
94-
### Ref functions
95-
96-
- getDuration
97-
- getCurrentTime
98-
- isMuted
99-
- getVolume
100-
- getPlaybackRate
101-
- getAvailablePlaybackRates
102-
- seekTo
103-
104-
## methods
105-
106-
- getYoutubeMeta
20+
[react-native-youtube-iframe](https://lonelycpp.github.io/react-native-youtube-iframe/)
10721

10822
## Contributing
10923

website/demo.gif

-4.07 MB
Binary file not shown.

0 commit comments

Comments
 (0)