# Autoplay=false not working when embedding stream via script

**URL:** <https://discuss.dev.twitch.com/t/autoplay-false-not-working-when-embedding-stream-via-script/12665>\
**Category:** API\
**Created:** [October 31, 2017, 7:25pm UTC](https://discuss.dev.twitch.com/t/autoplay-false-not-working-when-embedding-stream-via-script/12665 "2017-10-31T19:25:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Maffay](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Peter\_Maffay](https://discuss.dev.twitch.com/u/Peter_Maffay)\
**Post date:** [October 31, 2017, 7:25pm UTC](https://discuss.dev.twitch.com/t/autoplay-false-not-working-when-embedding-stream-via-script/12665/1 "2017-10-31T19:25:26Z")

</div>

Hey,  
i wanna work with the “new” embedding option via the javascript and ended in an autoplay false problem.

this is my script:

> ```
> <script type="text/javascript">
> $(document).ready(function(){
>       
> 		
> var embedtop = new Twitch.Embed("twitch_stream", {
> autoplay: false,
> width: "100%",
> height: 210,
> layout: "video",	
> channel: "hireztv" // for example
> });
> });
> </script>
> 
> ```

so why is the api ignoring the autoplay false. even if i add a event listender like:

> ```
> embedtop.addEventListener(Twitch.Embed.VIDEO_READY, () => {
> var player = embedtop.getPlayer();
> player.pause();
> });
> 
> ```

the player shows 1 or 2 seconds a paused stream and then starts playing.  
Seems like there is an override, but its not from my side. there is no other “autoplay” option in my code.

EDIT:  
Hey again 🙂  
i made a JSbin with the same code i use. nothing more.  
whats wrong with it? and if its a bug , does anyone know a workaround?

[jsbint](http://jsbin.com/yuwivisacu/1/edit?html,js,output)

just wait about 10 seconds, and the video starts … i dont want that !

You can uncomment the eventlistener with player pause and you will see that the stream starts imediatly . even with autoplay false ! oO

EDIT:  
Okay, maybe someone is new to the twitch api like i am and has the same question / problem.  
The autoplay option is only for videos from twitch with the “embed” api

You need to use the player api:

its a little bit more on the bottom of the twitch dev docs. then you can use autoplay false to a stream. Works now like a charm 🙂

---

<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:** [December 1, 2017, 1:41am UTC](https://discuss.dev.twitch.com/t/autoplay-false-not-working-when-embedding-stream-via-script/12665/3 "2017-12-01T01:41:10Z")

</div>

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