How to play YouTube videos in React native player?

Viewed 35

I want to play some YouTube videos in my react native app using a native player as we don't want to show youtube branding in the player. Is there any possible way to do this? If not, what's the best way to play youtube videos in react native app without showing youtube branding?

1 Answers

You can do this using react-native-webview.

  <WebView
    javaScriptEnabled={true}
    domStorageEnabled={true}
    scrollEnabled={false}
    source={{
      uri: `${"YOUR YOUTUBE URL"}?controls=0&showinfo=0&wmode=transparent&rel=0&mode=opaque`,
    }}
    style={{
      height: 200,
      width: Dimensions.get('window').width - 80,
    }}
    onError={(err) => {
      console.log(err, 'this is errr');
    }}
  />
Related