<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Iframe embedcontroller.play() broken in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5822797#M12300</link>
    <description>&lt;P&gt;I can confirm that it works again, thanks for the quick fix! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 08:31:20 GMT</pubDate>
    <dc:creator>pbrouwer</dc:creator>
    <dc:date>2024-01-18T08:31:20Z</dc:date>
    <item>
      <title>Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5820105#M12281</link>
      <description>&lt;P&gt;Since today it’s not possible anymore to play the song via the embed controller. It did works before though&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I’ve created a simple codepen example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/inlet/pen/oNVZvNa/4cbea3abe4d01ad9e2ded39e48dcd179" target="_blank" rel="noopener"&gt;https://codepen.io/inlet/pen/oNVZvNa/4cbea3abe4d01ad9e2ded39e48dcd179&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If the Spotify team can have a look at this that would be great, thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 23:45:02 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5820105#M12281</guid>
      <dc:creator>pbrouwer</dc:creator>
      <dc:date>2024-01-16T23:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5821417#M12292</link>
      <description>&lt;P&gt;Hi pbrouwer, thanks for highlighting this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm an engineer working on the embed player and the iframe API.&amp;nbsp;We are looking into this and should have a fix out soon. I'll keep you posted once the issue is fixed.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for your patience.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sushant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 16:25:51 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5821417#M12292</guid>
      <dc:creator>sushants</dc:creator>
      <dc:date>2024-01-17T16:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5822788#M12299</link>
      <description>&lt;P&gt;This should be fixed now. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 08:21:45 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5822788#M12299</guid>
      <dc:creator>sushants</dc:creator>
      <dc:date>2024-01-18T08:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5822797#M12300</link>
      <description>&lt;P&gt;I can confirm that it works again, thanks for the quick fix! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 08:31:20 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5822797#M12300</guid>
      <dc:creator>pbrouwer</dc:creator>
      <dc:date>2024-01-18T08:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833008#M12372</link>
      <description>&lt;P&gt;It doesn't work, Play() function doesn't work on embeds. I am completely stuck, all other functions work fine except for togglePlay() and Play(). loadUri works fine, but Play() not.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 00:35:27 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833008#M12372</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T00:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833059#M12373</link>
      <description>&lt;P&gt;Its definitely not fixed!!!!!! Play() does not work.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 01:09:51 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833059#M12373</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T01:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833060#M12374</link>
      <description>&lt;P&gt;Yo I need to hit deadlines and the most important thing in this embeded API doesn't work..... the play() functionality.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 01:12:45 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833060#M12374</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T01:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833647#M12378</link>
      <description>&lt;P&gt;It is not fixed, the original example doesn't work either. I am stuck with an embed that doesn't play even after calling the .play() function.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 09:27:59 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833647#M12378</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T09:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833667#M12379</link>
      <description>&lt;P&gt;Have you checked whether the issue is with autoplay restrictions being applied?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide" target="_blank"&gt;https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 09:41:53 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833667#M12379</guid>
      <dc:creator>sushants</dc:creator>
      <dc:date>2024-01-23T09:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833705#M12380</link>
      <description>&lt;P&gt;&amp;lt;!-- Spotify embed --&amp;gt;&lt;BR /&gt;&amp;lt;iframe&lt;BR /&gt;title="Spotify Embed"&lt;BR /&gt;style="border-radius:12px"&lt;BR /&gt;src={`&lt;A href="https://open.spotify.com/embed/episode/$" target="_blank"&gt;https://open.spotify.com/embed/episode/$&lt;/A&gt;{&lt;BR /&gt;selectedEpisode?.id || '1FMnK8XBsLRpTEOScXpwtQ'&lt;BR /&gt;}?utm_source=generator&amp;amp;theme=0`}&lt;BR /&gt;width="100%"&lt;BR /&gt;height="240"&lt;BR /&gt;frameBorder="0"&lt;BR /&gt;allow="autoplay; encrypted-media; clipboard-write; fullscreen; picture-in-picture"&lt;BR /&gt;loading="lazy"&lt;BR /&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Autoplay is set to true in the allow list - this embed is pulled straight from Spotify share episode/track button. The embed is being used within stock google Chrome. I am a software engineer, this is so unintuitive, this should be simple and very clear as its the base functionality you'd expect to be able to action when using the embed.&lt;BR /&gt;&lt;BR /&gt;Why can't we get the embedded player controller to play() when we call the play function or either auto play tracks onload. I am not the only one having these issues and the issue isn't fixed!! Look at the the original example posted on this thread, it doesn't play.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 10:11:36 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833705#M12380</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T10:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833749#M12381</link>
      <description>&lt;P&gt;The reason it is not working in the codepen link above is because the way codepen works does not guarantee that the page script is loaded by the time the iFrame API loads. The iFrame API needs the global `onSpotifyIframeApiReady` function to be available when it loads because without it, it won't know how to let the application know that it is ready to be used. This is something we can look into improving in the future. Try using this HTML provided below and see if it works. This is essentially, the exact code provided in the codepen link, but I'm inlining the javascript to ensure that the `onSpotifyIframeApiReady` is present when the iFrame API loads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;script src="https://open.spotify.com/embed/iframe-api/v1" async&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;div id="embed-iframe"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;button&amp;gt;Play&amp;lt;/button&amp;gt;
&amp;lt;script&amp;gt;
  let controller;

  window.onSpotifyIframeApiReady = IFrameAPI =&amp;gt; {
    const element = document.getElementById('embed-iframe');
    const options = {
      uri: 'spotify:track:7J1uxwnxfQLu4APicE5Rnj',
    };
    const callback = EmbedController =&amp;gt; {
      controller = EmbedController;
      controller.addListener('ready', () =&amp;gt; {
        console.log('ready');
      });
    };
    IFrameAPI.createController(element, options, callback);
  };

  document.querySelector('button').onclick = function () {
    // controller.loadUri("spotify:track:7J1uxwnxfQLu4APicE5Rnj");
    controller.play();
  };
&amp;lt;/script&amp;gt;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 11:15:54 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833749#M12381</guid>
      <dc:creator>sushants</dc:creator>
      <dc:date>2024-01-23T11:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833911#M12386</link>
      <description>&lt;P&gt;We are using SvelteKit/Svelte in production, any guidance how we can implement it with a Svelte friendly solution? Also, how can we change the colour to the darker version using the option config, I can't see theme key available on there.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 12:47:06 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833911#M12386</guid>
      <dc:creator>algoflows</dc:creator>
      <dc:date>2024-01-23T12:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833938#M12387</link>
      <description>&lt;P&gt;I've updated the codepen, weird thing is that it works on Safari now.. but on Chrome the Spotify player changes state (you see a pause button), but the song is not playing..&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;console log:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure what's causing the issue, it should play on button press. It used to work though&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 13:05:47 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833938#M12387</guid>
      <dc:creator>pbrouwer</dc:creator>
      <dc:date>2024-01-23T13:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833981#M12388</link>
      <description>&lt;P&gt;@algoflows I'm not sure about it as of now. I can explore this and get back to you in a while but unfortunately can't make any promises. For the theme, we recently added the option "theme" whose value can be set to "dark" to get the darker variant but&amp;nbsp; couldn't get around to updating the docs yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@pbrouwer This looks like the auto play restriction kicking in. May be how often auto play is triggered affects it in Chrome. Auto play restrictions are quite the black box across different browsers.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 13:35:11 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5833981#M12388</guid>
      <dc:creator>sushants</dc:creator>
      <dc:date>2024-01-23T13:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Iframe embedcontroller.play() broken</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5835822#M12397</link>
      <description>&lt;P&gt;@sushants It seems that the iframe in Codepen (editor mode) prevents the audio from playing. If you run it in plain html (debug mode) it seems to work just fine. Here's a working demo: (without Codepen editor iframe):&amp;nbsp;&lt;A href="https://cdpn.io/pen/debug/oNVZvNa/4cbea3abe4d01ad9e2ded39e48dcd179" target="_blank"&gt;https://cdpn.io/pen/debug/oNVZvNa/4cbea3abe4d01ad9e2ded39e48dcd179&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@algoflows The playback should run just fine as `&lt;A href="https://open.spotify.com/embed/iframe-api/v1`" target="_blank"&gt;https://open.spotify.com/embed/iframe-api/v1`&lt;/A&gt;&amp;nbsp;is framework agnostic. Just make sure the `window.onSpotifyIframeApiReady` is set before the script is loaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@sushants The API feels a little but clunky to be honest. If I was the author of the lib I would write it in a different fashion, example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script src="https://open.spotify.com/embed/iframe-api/v1"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;div id="iframe-embed"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;script&amp;gt;
  const iframe = document.getElementById('iframe-embed');
  const options = {
    theme: 'dark',
    width: 200,
    height: 400,
    uri: 'spotify:episode:7makk4oTQel546B0PZlDM5'
  }
  
  const player = spotify.createIframePlayer(iframe, options);

  // listen to ready
  player.addEventListener('ready', () =&amp;gt; {
    console.log('player instantiated');
  });
  
  // load uri promised based
  player.loadUri('spotify:episode:7makk4oTQel546B0PZlDM5').then(() =&amp;gt; {
    // loaded
  });

  // default playback controls
  player.play();
  player.seek();
  player.resume();
  player.pause();
  
  // destroy player &amp;amp; iframe
  player.dispose();
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Jan 2024 08:23:16 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Iframe-embedcontroller-play-broken/m-p/5835822#M12397</guid>
      <dc:creator>pbrouwer</dc:creator>
      <dc:date>2024-01-24T08:23:16Z</dc:date>
    </item>
  </channel>
</rss>

