tjallingt / react-youtube

react.js powered YouTube player component
http://tjallingt.github.io/react-youtube/
MIT License
1.85k stars 222 forks source link

Can't get rid of all the controls #164

Closed blakesisu closed 3 years ago

blakesisu commented 6 years ago

If I use the following iframe, the video works great, with no controls, but when I convert these params into the playerVars object, and pass into the youtube component, the top controls still show for the video. Any ideas why this might be? Thanks!

iframe: <iframe width="100%" height="100%" src="https://www.youtube.com/embed/mUWiJuo9Sj4?start=101&end=140&modestbranding=1&controls=0&showinfo=0&rel=0&autoplay=1&mute=1&loop=1&playlist=mUWiJuo9Sj4&autohide=1&theme=light" frameborder="0" allow="autoplay; encrypted-media"></iframe>

opts and youtube component:

const youTubeOpts = {
  height: '100%',
  width: '100%',
  playerVars: {
    autoplay: 1,
    start: 101,
    end: 140,
    controls: 0,
    showInfo: 0,
    theme: 'light',
    rel: 0,
    modestbranding: 0,
    disablekb: 1,
    mute: 1,
    loop: 1,
    playlist: youTubeVideoId,
    autohide: 1
  }
}

<YouTube
  videoId={youTubeVideoId}
  opts={youTubeOpts}
  onReady={this.onReady}
  onStateChange={this.onPlayerStateChange} />
tjallingt commented 6 years ago

Here are the opts that I use to hide the controls in a project: https://github.com/tjallingt/react-tjube/blob/master/src/components/Player/Player.jsx

These seem to hide the controls for me so if it doesn't work for you I'm not sure where that issue is coming from :(

blakesisu commented 6 years ago

Thanks for the response, still no dice, I'll let you know if I figure it out though

tjallingt commented 6 years ago

if you check: https://tjube-ninja.now.sh/ do you see the controls? then it might be your browser... otherwise some combination of playerVars is causing an issue probably. Hard to tell, haven't had or heard of any issues like this

blakesisu commented 6 years ago

I'm getting an error with the playback, maybe I should update my chrome, it hasn't been too long but I do think they made a recent change to the api. For now I'm just using an iframe and init function to capture the state change and ready trigger.

Here's the error: 2018-09-27-130538_892x252_scrot

Komsomol commented 5 years ago

Set modestbranding: 0 to modestbranding: 1