Embedding on a private website

So after the changes to the embedding system a few days ago, I don’t know how to use the parent parameter correctly.
I have a local website (on my pi) and I’m not sure what to set as the value for the parent.

To the domain name of the website that the page is served from.

Additionally it has to be served over SSL.

If you use the JS embed it’ll automagically determine the Parent for you

So the last couple days I tried to fix my problem, but it still doesn’t work.

Changes I made:

  • enable ssl on node red
  • use JS to embed
  • a lot of other little things (I think irrelevant)

So to clarify the situation, I use twitch-embeding on a website running with Node-RED on my pi 4 (only accessible through my local network), the ip I use to reach it is https://pi:1880/stream
I use a self-signed ssl certificate (chrome says it is invalid, likely because it is self-signed)

Here is my code:

<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
<div id="stream"></div>
<script type="text/javascript">
    var options = {
        width: 854,
        height: 480,
        channel: "zinus",
    };
    var player = new Twitch.Player("stream", options);
    player.setVolume(0.5);
</script>

<iframe frameborder="0"
        scrolling="no"
        id="chat_embed"
        src="https://www.twitch.tv/embed/hebo/zinus?parent=pi"
        height="500"
        width="350">
</iframe>

So on both the chant and the stream I get the message player.twitch.tv hat die Verbindung abgelehnt.,
in English maybe something like player.twitch.tv refused to connect.

Twitch does not support non standard ports on domains that are not localhost.

It’s expecting to be on port 443 for SSL. That is the issue here.

Non standard ports are only support for localhost/127.0.0.1

Oh thank you, was this anywhere specified in the twitch doc?

Not directly, in passes when discussing support for localhost.

But the CSP error in the console does list the domains it expects on the domains you provide

With a domain of https://pi:1880 the domain you added in parents is pi Twitch interprets that and adds it to the CSP rule as https://pi/

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