Twitch embed Player+Chat editabel channel

Hi, i have small problem.
I want to make twitch player when i click streamer button then open his stream.

<script src="https://embed.twitch.tv/embed/v1.js"></script>
<div id="streamwindow"></div>

<script type="text/javascript">
  new Twitch.Embed("streamwindow", {
    parent: ["ravioli.site"],
    width: "100%",
    height: "100%",
    theme: "dark",
    autoplay: true,
  });

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

And .js file
player.setChannel(temp)

temp is streamer name variable

That is not a good idea as if someone clicks the player to pause the stream or change the volume, they’ll be sent to the stream.

The preferred way is to tell users that to visit the stream they just have to hover the player and click the streamers name in the title section, the functionality you need is already built into the player.

I mean when user click special icon the show hidden div with multi channel player with chat. Everything on one site.

“special icon”?

I think what you are trying to do is not to go to the streamers page, which is what you wrote

but to change what stream is being played in the embed?

var player = embed.getPlayer();
player.setChannel(target_channel)

use the setChannel function

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