• English
  • 2.x
  • Quick Start

    Examples & Demo

    The smallest working example looks like this:

    import { YoutubeView, useYouTubePlayer } from 'react-native-youtube-bridge';
    
    function App() {
      const player = useYouTubePlayer('AbZH7XWDW_k');
    
      return <YoutubeView player={player} />;
    }

    Accepted source forms

    You can initialize the player with:

    const playerA = useYouTubePlayer('AbZH7XWDW_k');
    const playerB = useYouTubePlayer({ videoId: 'AbZH7XWDW_k' });
    const playerC = useYouTubePlayer({ url: 'https://www.youtube.com/watch?v=AbZH7XWDW_k' });

    Add initial player options

    const player = useYouTubePlayer('AbZH7XWDW_k', {
      autoplay: true,
      controls: true,
      playsinline: true,
      rel: false,
      muted: true,
    });

    Next steps