Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"autoplay", "loop" and "mute" options don't work #411

Open
barbararcbf12 opened this issue Mar 19, 2024 · 3 comments
Open

"autoplay", "loop" and "mute" options don't work #411

barbararcbf12 opened this issue Mar 19, 2024 · 3 comments

Comments

@barbararcbf12
Copy link

barbararcbf12 commented Mar 19, 2024

I'm using react-youtube in a ReactJS + TypeScript-project and I use it like below.

I am adding the following opts to my player, but the autoplay, mute and the loop options won't work.

I managed to get the "autoplay" and the "mute" to work by accessing the "InternalPlayer" (see code below) but the loop doesn't work.

<YouTube
   ref={youtubePlayerRef}
   ...
   onReady={() => {
    youtubePlayerRef.current?.getInternalPlayer().mute();
    youtubePlayerRef.current?.getInternalPlayer().playVideo();
    youtubePlayerRef.current?.getInternalPlayer().setLoop(true);
  }}
   opts={{
      host: 'https://www.youtube-nocookie.com',
      playerVars: {
         modestbranding: 1,
         loop: 1,
         rel: 0,
         autoplay: 1,
         controls: 0,
         mute: 0,
         showinfo: 0,
      },
  }}
/>
@suksa
Copy link

suksa commented Apr 9, 2024

mute: 1

@chichichunam
Copy link

mute works with '1' but loop does not work tho.

@mrchess
Copy link

mrchess commented Apr 21, 2024

Doubt it will get fixed. Repo hasn't been updated in 2 years. Switch to https://github.com/cookpete/react-player

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants