title: Autoplay Play Promise with YouTube API
body: <p>With the <a href="https://developers.google.com/web/updates/2017/09/autoplay-policy-changes" rel="nofollow noreferrer">recent changes to how Chrome autoplays videos</a>, I'm trying to determine if there is a way to have a play promise for an autoplaying iframe, more specifically the YouTube API.</p>
  
  <p>Currently, I'm using this code for HTML5 <code>&lt;video&gt;</code>'s:</p>
  
  <pre><code>var promise = $( 'video' ).get(0).play();
  
  if (promise !== undefined) {
    promise.then(_ =&gt; {
      // Autoplay started!
    }).catch(error =&gt; {
      // Autoplay was prevented.
    });
  }
  </code></pre>
  
  <p>But if I'm using the YouTube API, I can not get the video object. I tried the code below, but it won't work due to no object.</p>
  
  <pre><code>var promise = YTPlayer.playVideo()
  </code></pre>
  
  <p>Does anyone have any recommendations or know if this is even possible at the moment?</p>
  
  <p>Thanks!</p>