Sonos SMAPI unable to start playback of cloudQueue when receiving GET context and itemWindow

79 Views Asked by At

I am currently developing an API connection between my application, and Sonos Cloud API. When initiating the loadCloudQueue command, some of tested players, will not start the playback of the cloudQueue, but only the one item described in the loadCloudQueue command itself.

I really working blind, due to some of the players are able to start the cloudQueue playback, and some of them are now.

When testing the player, it is able to ask for the GET / Context and the GET / itemWindow.

  • But it never starts.

Example of the GET / Context response:

queueVersion: 608124fb068ff506234390dd,
contextVersion: 608124fb068ff506234390dd,
container: { name: 'Handcrafted playlist for Ole ' },
reports: { sendUpdateAfterMillis: 100000, sendPlaybackActions: true },
playbackPolicies: {
    canSkip: true,
    limitedSkips: false,
    canSkipToItem: false,
    canSkipBack: false,
    canSeek: false,
    canRepeat: true,
    canRepeatOne: false,
    canCrossfade: true,
    canShuffle: false,
    showNNextTracks: 10,
    showNPreviousTracks: 10
  }
 }

And the itemWindow response:

1|app  | {
1|app  |   isExplicit: 'false',
1|app  |   reason: 'load',
1|app  |   itemId: '5f9d1e98e51a783b3bb741a8-2',
1|app  |   positionMillis: '2335',
1|app  |   queueVersion: '608124fb068ff506234390dd',
1|app  |   contextVersion: '608124fb068ff506234390dd',
1|app  |   previousWindowSize: '9',
1|app  |   upcomingWindowSize: '10'
1|app  | }
1|app  | {
1|app  |   includesBeginningOfQueue: true,
1|app  |   includesEndOfQueue: false,
1|app  |   queueVersion: 608124fb068ff506234390dd,
1|app  |   contextVersion: 608124fb068ff506234390dd,
1|app  |   items: [
1|app  |     {
1|app  |       itemId: '5f9d1e98e51a783b3bb741a8-2',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '5f9f16df0255876d60a379c2-3',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '5f9fd3606941737c38b52845-4',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '5f9fd741c790807608310700-5',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '5fc39512583fe814cc017df4-6',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '602b9707aa5ff30a5ce2e72a-7',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '603f977f64c25e20af3b2cb0-8',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '6040e7ca0c32a64babe1d19b-9',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     },
1|app  |     {
1|app  |       itemId: '604fbefaf627431c25f670d2-10',
1|app  |       deleted: false,
1|app  |       track: [Object]
1|app  |     }
1|app  |   ]
1|app  | }

I really apreciate all the good advises I can get

1

There are 1 best solutions below

2
On

An example of a functional request & response for /context & /itemWindow:

  • request to /context:
200 [06/01/21 5:03:14 pm] GET /v2.3/radio/myprefix%3a123456789012345678901234/context?queueVersion=&contextVersion= ReqToken- Bearer <authToken> ResToken- -
  • response from /context:
{
  contextVersion: 'CV:00001',
  queueVersion: 'QV:00001',
  container: {
    type: 'trackList.program',
    name: 'my cool name',
    imageUrl: 'https://myartworkdomain/program_default.jpg',
    id: { objectId: 'myprefix:123456789012345678901234' }
  },
  playbackPolicies: {
    canSkip: true,
    limitedSkips: true,
    canSkipToItem: false,
    canSkipBack: false,
    canSeek: false,
    canCrossfade: true,
    canRepeat: true,
    canRepeatOne: false,
    canShuffle: false,
    pauseAtEndOfQueue: false,
    showNPreviousTracks: 0,
    showNNextTracks: 1
  },
  reports: { sendUpdateAfterMillis: 5000, periodicIntervalMillis: 30000 }
}
  • request to /itemWindow:
200 [06/01/21 5:03:17 pm] GET /v2.3/radio/myprefix%3a123456789012345678901234/itemWindow?isExplicit=true&reason=load&itemId=&positionMillis=0&queueVersion=&contextVersion=CV%3a00001&previousWindowSize=9&upcomingWindowSize=10&heardItemId= ReqToken- Bearer <authToken> ResToken- -
  • response from /itemWindow:
{
  contextVersion: 'CV:00001',
  queueVersion: 'QV:00001',
  items: [
    {
      id: 'C6RRZGXP',
      deleted: false,
      policies: { canSkip: true },
      track: {
        name: '<name>',
        album: { name: '<albumName>', artist: { name: '<artistName>' } },
        artist: { name: '<artistName>' },
        imageUrl: 'https://myartworkdomain.com/e24f71bf24f67a38eeeed6865d2bd582.jpeg',
        mediaUrl: 'https://mystreamdomain.com/e24f71bf24f67a38eeeed6865d2bd582.m4a',
        durationMillis: 123456,
        contentType: 'audio/aac'
      }
    },
    {
      id: 'FT46XQT3',
      deleted: false,
      policies: { canSkip: true },
      track: {
        name: '<name>',
        album: { name: '<albumName>', artist: { name: '<artistName>' } },
        artist: { name: '<artistName>' },
        imageUrl: 'https://myartworkdomain.com/0cff6be10e41a0beed35438b1e43bf8b.jpeg',
        mediaUrl: 'https://mystreamdomain.com/0cff6be10e41a0beed35438b1e43bf8b.m4a',
        durationMillis: 234567,
        contentType: 'audio/aac'
      }
    }
  ],
  limitedSkipsState: { skipsRemaining: 3, skipLimitReached: false },
  includesBeginningOfQueue: true,
  includesEndOfQueue: false
}

This should work.