vime-js / vime

Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
https://vimejs.com
MIT License
2.75k stars 154 forks source link

initialMuted not set in the right lifecycle method #320

Closed codrin-iftimie closed 2 years ago

codrin-iftimie commented 2 years ago

I'm trying to have a vimeo video autoplay as muted in React.

function VimeoVideo({ src }) {
  return (
    <Player muted autoplay>
      <Vimeo videoId={src} />
      <Ui>
        <Poster />
      </Ui>
    </Player>
  );
}

After some debugging (the first time I'm interacting with custom elements) noticed that the underlying "driver" is stencil. While checking https://github.com/vime-js/vime/blob/main/packages/core/src/components/providers/vimeo/vimeo.tsx#L191 noticed that the lifecycle is wrong. Changing it to componentWillLoad solves the issue. I would be happy to provide a PR for this since most of the hard part (debugging) is done. This applies to most provider components, too.

mihar-22 commented 2 years ago

Awesome! Happy to accept a PR @codrin-iftimie :)