<?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 State conflict when integrate web-playback-sdk and Player API in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5270884#M3339</link>
    <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I integrated playback SDK with Player API in my side project, mostly is functional&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but when i playing music on local initialized playback and click set repeat mode button.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;It would trigger error (technically, no error coz API response is 2xx).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;API i called is following order&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;/me/player/repeat with device Id and state=context&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;endpoint would return 204 (That expected because it async command nature of Spotify API)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;but it also auto called below API from Playback SDK &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;/track-playback/v1/devices/:deviceId/state&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/track-playback/v1/devices/:deviceId/state_conflict&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;And after that, player repeat mode just get rollbacked to before.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;How can i fix it ?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Attached is HAR captrued from network console. you can take a look first 2 ~ 5 entries.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OS: MacOS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Browser: Latest Chrome&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Ref:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Playback SDK&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developer.spotify.com/documentation/web-playback-sdk/" target="_blank"&gt;https://developer.spotify.com/documentation/web-playback-sdk/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Player API&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developer.spotify.com/console/player/" target="_blank"&gt;https://developer.spotify.com/console/player/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My side project&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://dnghk-spotify-player.netlify.app/" target="_blank"&gt;https://dnghk-spotify-player.netlify.app/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Source code for set repeat mode&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://github.com/davidNHK/spotify-music-player/blob/development/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/commands/setRepeatMode.ts#L5" target="_blank"&gt;https://github.com/davidNHK/spotify-music-player/blob/development/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/commands/setRepeatMode.ts#L5&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 04 Oct 2021 12:39:09 GMT</pubDate>
    <dc:creator>DavidNgHK</dc:creator>
    <dc:date>2021-10-04T12:39:09Z</dc:date>
    <item>
      <title>State conflict when integrate web-playback-sdk and Player API</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5270884#M3339</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I integrated playback SDK with Player API in my side project, mostly is functional&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but when i playing music on local initialized playback and click set repeat mode button.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;It would trigger error (technically, no error coz API response is 2xx).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;API i called is following order&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;/me/player/repeat with device Id and state=context&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;endpoint would return 204 (That expected because it async command nature of Spotify API)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;but it also auto called below API from Playback SDK &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;/track-playback/v1/devices/:deviceId/state&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/track-playback/v1/devices/:deviceId/state_conflict&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;And after that, player repeat mode just get rollbacked to before.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;How can i fix it ?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Attached is HAR captrued from network console. you can take a look first 2 ~ 5 entries.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OS: MacOS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Browser: Latest Chrome&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Ref:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Playback SDK&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developer.spotify.com/documentation/web-playback-sdk/" target="_blank"&gt;https://developer.spotify.com/documentation/web-playback-sdk/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Player API&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developer.spotify.com/console/player/" target="_blank"&gt;https://developer.spotify.com/console/player/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My side project&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://dnghk-spotify-player.netlify.app/" target="_blank"&gt;https://dnghk-spotify-player.netlify.app/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Source code for set repeat mode&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://github.com/davidNHK/spotify-music-player/blob/development/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/commands/setRepeatMode.ts#L5" target="_blank"&gt;https://github.com/davidNHK/spotify-music-player/blob/development/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/commands/setRepeatMode.ts#L5&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Oct 2021 12:39:09 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5270884#M3339</guid>
      <dc:creator>DavidNgHK</dc:creator>
      <dc:date>2021-10-04T12:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: State conflict when integrate web-playback-sdk and Player API</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5271375#M3348</link>
      <description>&lt;P&gt;Hey David,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I couldn't replicate the issue. I also see the "state_conflict" message but the repeat state is correctly set according to the following API calls. Note that I'm not sending the "device_id" as query parameter, so it will use&amp;nbsp;&lt;SPAN&gt;the user’s currently active device as the target:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/me/player/repeat?state=context // repeat current context
/me/player/repeat?state=track   // repeat current track
/me/player/repeat?state=off     // turn off repeat mode
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be aware that the repeat state does not work as a toggle. If you want to turn it off, you must send the "state=off" parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 10:38:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5271375#M3348</guid>
      <dc:creator>alvaron</dc:creator>
      <dc:date>2021-10-05T10:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: State conflict when integrate web-playback-sdk and Player API</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5271663#M3350</link>
      <description>&lt;P&gt;Hi Alvaron ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Turn out i find that the error is come from my code there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/davidNHK/spotify-music-player/blob/25c24f64b575e70b8e36d6ad9ae2baffcfcf9ea6/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/index.ts#L140" target="_blank"&gt;https://github.com/davidNHK/spotify-music-player/blob/25c24f64b575e70b8e36d6ad9ae2baffcfcf9ea6/systems/web-frontend/src/contexts/SpotifyWebPlayback/states/LocalPlaybackState/index.ts#L140&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the "context" repeat state is 1 instead of 2 actually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i think it could be better if you guys can update document here. about the repeat_mode number&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.spotify.com/documentation/web-playback-sdk/reference/#object-web-playback-state" target="_blank" rel="noopener"&gt;https://developer.spotify.com/documentation/web-playback-sdk/reference/#object-web-playback-state&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it stated "1" is "once-repeat"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course , it would more more ideal if the response can just follow /me/player API.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-information-about-the-users-current-playback" target="_blank" rel="noopener"&gt;https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-information-about-the-users-current-playback&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it just return string instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 23:58:01 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5271663#M3350</guid>
      <dc:creator>DavidNgHK</dc:creator>
      <dc:date>2021-10-05T23:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: State conflict when integrate web-playback-sdk and Player API</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5272028#M3357</link>
      <description>Hey David,&lt;BR /&gt;&lt;BR /&gt;Glad to read you were able to fix the issue!&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your feedback. We have updated the example with the correct values: &lt;BR /&gt;&lt;A href="https://developer.spotify.com/documentation/web-playback-sdk/reference/#object-web-playback-state" target="_blank"&gt;https://developer.spotify.com/documentation/web-playback-sdk/reference/#object-web-playback-state&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I have also forwarded your suggestion to the corresponding team &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers</description>
      <pubDate>Wed, 06 Oct 2021 10:08:36 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/State-conflict-when-integrate-web-playback-sdk-and-Player-API/m-p/5272028#M3357</guid>
      <dc:creator>alvaron</dc:creator>
      <dc:date>2021-10-06T10:08:36Z</dc:date>
    </item>
  </channel>
</rss>

