How to position embed twitch on my webpage?

Hi, i have embed twitch video and chat, but i havent figured out how to position it?
code:
`

<!-- Load the Twitch embed script -->
<script src="https://embed.twitch.tv/embed/v1.js"></script>

<!--
  Create a Twitch.Embed object that will render
  within the "twitch-embed" root element.
-->
<script type="text/javascript">
  var embed = new Twitch.Embed("twitch-embed", {
    width: "90%",
    height: "60%",
    channel: "monstercat",
    layout: "video-with-chat",
    autoplay: false
  });

  embed.addEventListener(Twitch.Embed.VIDEO_READY, () => {
    var player = embed.getPlayer();
    player.play();
  });
</script>`

Your code is missing a

<div id="twitch-embed"></div>

CSS positioning can be applied to that.

1 Like

Thanks, one more question, why i cant click on anything? Cant click chat, pause the stream or even change volume. I can just see the stream and chat.

No idea. Works fine for me.

Sounds like you have some CSS/layout borking up and throwing a transparent div in the way

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.