<?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 iframe API startAt bug in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661113#M11341</link>
    <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I was working with the Spotify iframe API found here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://open.spotify.com/embed/iframe-api/v1" target="_blank" rel="nofollow noopener noreferrer"&gt;https://open.spotify.com/embed/iframe-api/v1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;and noticed a bug related to this.options.startAt found in this script:&lt;BR /&gt;&lt;A href="https://embed-cdn.spotifycdn.com/_next/static/iframe_api.92ca45a15d3476e3ab9a.js" target="_blank" rel="noopener"&gt;https://embed-cdn.spotifycdn.com/_next/static/iframe_api.92ca45a15d3476e3ab9a.js&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;the bug is found inside the function loadUri:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.loadUri = (uriString, preferVideo = false, timestampInSeconds = 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;specifically this block:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (this.options.startAt || timestampInSeconds) {
  const startAt = timestampInSeconds !== null &amp;amp;&amp;amp; timestampInSeconds !== void 0 
    ? timestampInSeconds 
    : parseInt((_a = this.options.startAt) !== null &amp;amp;&amp;amp; _a !== void 0 ? _a : '0', 10);
  
  if (!isNaN(startAt)) {
    embedURL.searchParams.append('t', startAt.toString());
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the bug is that this.options.startAt will never be used since timestampInSeconds defaults to 0.&lt;BR /&gt;&lt;BR /&gt;to fix it, I believe all that needs to be added is &amp;amp;&amp;amp; timestampInSeconds !== 0 so we fallback to this.options.startAt if it is 0:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (this.options.startAt || timestampInSeconds) {
  const startAt = timestampInSeconds !== null &amp;amp;&amp;amp; timestampInSeconds !== void 0 &amp;amp;&amp;amp; timestampInSeconds !== 0 
    ? timestampInSeconds 
    : parseInt((_a = this.options.startAt) !== null &amp;amp;&amp;amp; _a !== void 0 ? _a : '0', 10);
  
  if (!isNaN(startAt)) {
    embedURL.searchParams.append('t', startAt.toString());
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S: I'm not really sure why timestampInSeconds exists since the loadUri function is only called with 2 arguments everytime (uri and preferVideo)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;not sure where the correct place to post this was, hopefully this was the place!&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 23:52:36 GMT</pubDate>
    <dc:creator>jaredp_</dc:creator>
    <dc:date>2023-11-02T23:52:36Z</dc:date>
    <item>
      <title>iframe API startAt bug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661113#M11341</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I was working with the Spotify iframe API found here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://open.spotify.com/embed/iframe-api/v1" target="_blank" rel="nofollow noopener noreferrer"&gt;https://open.spotify.com/embed/iframe-api/v1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;and noticed a bug related to this.options.startAt found in this script:&lt;BR /&gt;&lt;A href="https://embed-cdn.spotifycdn.com/_next/static/iframe_api.92ca45a15d3476e3ab9a.js" target="_blank" rel="noopener"&gt;https://embed-cdn.spotifycdn.com/_next/static/iframe_api.92ca45a15d3476e3ab9a.js&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;the bug is found inside the function loadUri:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.loadUri = (uriString, preferVideo = false, timestampInSeconds = 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;specifically this block:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (this.options.startAt || timestampInSeconds) {
  const startAt = timestampInSeconds !== null &amp;amp;&amp;amp; timestampInSeconds !== void 0 
    ? timestampInSeconds 
    : parseInt((_a = this.options.startAt) !== null &amp;amp;&amp;amp; _a !== void 0 ? _a : '0', 10);
  
  if (!isNaN(startAt)) {
    embedURL.searchParams.append('t', startAt.toString());
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the bug is that this.options.startAt will never be used since timestampInSeconds defaults to 0.&lt;BR /&gt;&lt;BR /&gt;to fix it, I believe all that needs to be added is &amp;amp;&amp;amp; timestampInSeconds !== 0 so we fallback to this.options.startAt if it is 0:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (this.options.startAt || timestampInSeconds) {
  const startAt = timestampInSeconds !== null &amp;amp;&amp;amp; timestampInSeconds !== void 0 &amp;amp;&amp;amp; timestampInSeconds !== 0 
    ? timestampInSeconds 
    : parseInt((_a = this.options.startAt) !== null &amp;amp;&amp;amp; _a !== void 0 ? _a : '0', 10);
  
  if (!isNaN(startAt)) {
    embedURL.searchParams.append('t', startAt.toString());
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S: I'm not really sure why timestampInSeconds exists since the loadUri function is only called with 2 arguments everytime (uri and preferVideo)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;not sure where the correct place to post this was, hopefully this was the place!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 23:52:36 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661113#M11341</guid>
      <dc:creator>jaredp_</dc:creator>
      <dc:date>2023-11-02T23:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: iframe API startAt bug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661180#M11347</link>
      <description>&lt;P&gt;When I was using the iFrame API, I had a similar use case. I saw that there were some stubs for startAt, but they never did anything. I ended up hacking together a solution that just called seek() until the page finished loading, but this would have been much cleaner. +1&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 23:43:27 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661180#M11347</guid>
      <dc:creator>trevorflan</dc:creator>
      <dc:date>2023-11-02T23:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: iframe API startAt bug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661184#M11348</link>
      <description>&lt;P&gt;+2!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 00:03:25 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iframe-API-startAt-bug/m-p/5661184#M11348</guid>
      <dc:creator>stellaw1</dc:creator>
      <dc:date>2023-11-03T00:03:25Z</dc:date>
    </item>
  </channel>
</rss>

