[embed] parent query string value was not specified

I am trying to embed a twitch stream in a page and view it locally. I am using code straight from the twitch API documentation except I changed the parent query string to ‘localhost’. The code I am using is this:

<html>
  <body>
    <!-- Add a placeholder for the Twitch embed -->
    <div id="twitch-embed"></div>

    <!-- 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">
      new Twitch.Embed("twitch-embed", {
        width: 854,
        height: 480,
        channel: "monstercat",

        parent: ["localhost"]
      });
    </script>
  </body>
</html>

In my console in see this error:
Twitch embed error message:
[NoParent] parent query string value was not specified
Docs: https://dev.twitch.tv/docs/embed/video-and-clips/

    <script type="text/javascript">
      new Twitch.Embed("twitch-embed", {
        width: 854,
        height: 480,
        channel: "monstercat"
      });
    </script>

Should work fine, as if you specify no parent, the embed library will auto determine for you.

Otherwise there does not seem to be a fault with your code.

1 Like

I am still getting the same error. In my browser URL bar is the following:

file:///C:/Users/JC/Desktop/twitchplayer/main.html

Which is the path to my file. Am i doing everything correctly?

You cannot use the embed on pages using the file protocol. It needs to be HTTP (localhost) or HTTPS (anywhere). You can run a local web server to serve the file and then access it via http://localhost/

1 Like

ok thank you

Would it work with github hosting?

Yes, as it’s a website served over SSL

1 Like

4 posts were merged into an existing topic: The great big “I’m using WIX/SomeWebsiteMaking Tool and I don’t know how to fix my embed” thread

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