# Embed video autoplay is not honored

**URL:** <https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795>\
**Category:** API\
**Created:** [May 14, 2018, 9:14pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795 "2018-05-14T21:14:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![swidjaja](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/swidjaja/32/4551_2.png) [@swidjaja](https://discuss.dev.twitch.com/u/swidjaja)\
**Post date:** [May 14, 2018, 9:14pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/1 "2018-05-14T21:14:39Z")

</div>

Hi all,

I was trying to create a twich embedded iframe using JS. Here is my code:

```
const options = {
  width: '100%',
  height: '100%',
  channel: 'some-channel-id',
  layout: 'video',
  autoplay: false
};

const twitchPlayer = new Twitch.Embed(this.get('videoPlayerId'), options);

```

However, the embed video plays immediately even though I set the autoplay: false. Looking at the iframe, I didn’t see the autoplay option being part of the iframe url query parameter -

`<iframe src="https://embed.twitch.tv?channel=some-channel-id&layout=video&referrer=some-referer-url" allowfullscreen="" scrolling="no" frameborder="0" width="100%" height="100%"></iframe>lowfullscreen="" scrolling="no" frameborder="0" width="100%" height="100%"></iframe>`

Could someone help? Thank you very much in advanced!

Best,  
Sugi

---

<div class="post-metadata">

**Author:** ![matt\_thomas](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/matt_thomas/32/710_2.png) [@matt\_thomas](https://discuss.dev.twitch.com/u/matt_thomas)\
**Post date:** [May 14, 2018, 9:24pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/2 "2018-05-14T21:24:15Z")

</div>

> autoplay=false

on the iframe ?

---

<div class="post-metadata">

**Author:** ![swidjaja](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/swidjaja/32/4551_2.png) [@swidjaja](https://discuss.dev.twitch.com/u/swidjaja)\
**Post date:** [May 14, 2018, 9:29pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/3 "2018-05-14T21:29:27Z")

</div>

Hi Matt. I didn’t construct the iframe manually but create it via this `const twitchPlayer = new Twitch.Embed(this.get('videoPlayerId'), options);` Inside the options object, I add `autoplay: false` per the tutorial.

---

<div class="post-metadata">

**Author:** ![matt\_thomas](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/matt_thomas/32/710_2.png) [@matt\_thomas](https://discuss.dev.twitch.com/u/matt_thomas)\
**Post date:** [May 14, 2018, 10:50pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/4 "2018-05-14T22:50:54Z")

</div>

Is the tutorial you are reading for clips or videos only, regarding the autoplay=false?

---

<div class="post-metadata">

**Author:** ![swidjaja](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/swidjaja/32/4551_2.png) [@swidjaja](https://discuss.dev.twitch.com/u/swidjaja)\
**Post date:** [May 14, 2018, 11:07pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/5 "2018-05-14T23:07:38Z")

</div>

Here is the tutorial that I read

```
    <!-- 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: 854,
        height: 480,
        channel: "monstercat",
        layout: "video",
        autoplay: false
      });

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

---

<div class="post-metadata">

**Author:** ![matt\_thomas](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/matt_thomas/32/710_2.png) [@matt\_thomas](https://discuss.dev.twitch.com/u/matt_thomas)\
**Post date:** [May 14, 2018, 11:31pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/6 "2018-05-14T23:31:57Z")

</div>

You want the “Interactive Frames for Live Streams and VODs” bit, not that one.

It uses ‘Player’ not ‘Embed’

```
<html>
  <body>
<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
<div id="player"></div>
<script type="text/javascript">
  var options = {
    width: 1280,
    height: 720,
    channel: "monstercat",
    autoplay: false,
  };
  var player = new Twitch.Player("player", options);
  player.setVolume(0.5);
</script>
  </body>
</html>
```

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [June 13, 2018, 11:32pm UTC](https://discuss.dev.twitch.com/t/embed-video-autoplay-is-not-honored/15795/7 "2018-06-13T23:32:05Z")

</div>

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