Search code examples
javascriptiframetwitch

Embedding an iframe that requires parent


Sorry, don't even know how to ask this question correctly. To embed a Twitch iframe I need to define 'parent' field. My website uses a port to get access to it. Like https://example.com:447, but 'parent' field requires values without ':', so I can't use my url here. If I use it like example.com it doesn't work since it's without port. Please prompt me for a vector to look for a solution.

        let options = {
            width: '640',
            height: '360',
            [contentType]: data['twitch-content'],
            parent: ['example.com:447', 'example.com'],
            autoplay: !!data['twitch-autoplay'],
            muted: !!data['twitch-muted']
        };

        let player = new Twitch.Player(el.id, options);

Solution

  • https://discuss.dev.twitch.tv/t/embedding-on-a-private-website/26366/4

    Twitch does not support non standard ports on domains that are not localhost. It’s expecting to be on port 443 for SSL. [...] Non standard ports are only support for localhost/127.0.0.1

    It seems like the only possible solutions are you either use localhost for testing in a local development environment or use a website that uses port 80 for HTTP or port 443 for HTTPS.