|
4 年之前 | |
---|---|---|
.. | ||
src | 4 年之前 | |
.eslintrc.js | 4 年之前 | |
.prettierrc.js | 4 年之前 | |
LICENSE | 4 年之前 | |
_config.yml | 4 年之前 | |
index.d.ts | 4 年之前 | |
index.js | 4 年之前 | |
package.json | 4 年之前 | |
readme.md | 4 年之前 |
A wrapper of the Youtube IFrame player API build for react native.
This package uses react-hooks and therefore will need react-native 0.59
or above
(recommended - react native version - 0.60
or above)
react-native-webview
.Bare React Native app - Instructions
0.60
and above, install the latest version of react-native-webview0.60
, react-native-webview version 6.11.1
is the last version that supports it.Expo Managed App - Instructions
npm install react-native-youtube-iframe
import React, {useRef, useState} from 'react';
import YoutubePlayer from 'react-native-youtube-iframe';
const playerRef = useRef(null);
const [playing, setPlaying] = useState(true);
<YoutubePlayer
ref={playerRef}
height={300}
width={400}
videoId={"AVAc1gYLZK0"}
play={playing}
onChangeState={event => console.log(event)}
onReady={() => console.log("ready")}
onError={e => console.log(e)}
onPlaybackQualityChange={q => console.log(q)}
volume={50}
playbackRate={1}
playerParams={{
cc_lang_pref: "us",
showClosedCaptions: true
}}
/>
list of available APIs -
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.