{"record":{"id":"14ea5a45b734f71b","repo":"tonhowtf/omniget","slug":"spotify-sdk-playback-error","errorCode":null,"errorMessage":"[spotify-sdk] playback error:","messagePattern":"\\[spotify-sdk\\] playback error:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/spotify-sdk.svelte.ts","lineNumber":186,"sourceCode":"              reject(new Error(message));\n            },\n          );\n          player.addListener(\n            \"authentication_error\",\n            ({ message }: { message: string }) => {\n              this.unavailableReason = `auth: ${message}`;\n            },\n          );\n          player.addListener(\n            \"account_error\",\n            ({ message }: { message: string }) => {\n              this.unavailableReason = `Spotify Premium é obrigatório (${message})`;\n            },\n          );\n          player.addListener(\n            \"playback_error\",\n            ({ message }: { message: string }) => {\n              console.warn(\"[spotify-sdk] playback error:\", message);\n            },\n          );\n          player.addListener(\n            \"player_state_changed\",\n            (state: SpotifySdkState | null) => {\n              this.emitState(state);\n            },\n          );\n\n          this.player = player;\n          void player.connect().catch((e) => {\n            this.unavailableReason = `connect: ${String(e)}`;\n            this.loading = false;\n            reject(e);\n          });\n        };\n\n        if (window.Spotify) {","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/spotify-sdk.svelte.ts#L168-L204","documentation":"The Spotify Web Playback SDK player emitted a 'playback_error' event, logged here with the SDK's message string. This means the SDK connected but a playback attempt on the device failed (e.g. track unplayable, licensing restrictions, device state issue). It is a per-playback failure, not an initialization failure.","triggerScenarios":"The Spotify SDK player fires playback_error while a track transfer/play request targets this device — commonly when the requested content cannot be played on this device or session.","commonSituations":"Attempting to play region-locked or removed tracks; Spotify account without Premium (separate init_error path sets unavailableReason about Premium) but with a stale device state; device already claimed by another session; DRM/EME issues in the browser.","solutions":["Read the logged `message` from the SDK for the specific playback failure reason.","Verify the account is Premium — Web Playback SDK requires Premium.","Retry the play request / re-transfer playback to this device; stale device state often resolves after a fresh transfer.","Check EME/DRM support (encrypted media) in the browser if messages indicate decoding failure."],"exampleFix":"// before\nplayer.addListener(\"playback_error\", ({ message }) => { console.warn(\"[spotify-sdk] playback error:\", message); });\n// after\nplayer.addListener(\"playback_error\", ({ message }) => {\n  console.warn(\"[spotify-sdk] playback error:\", message);\n  this.emitError({ kind: \"playback\", message }); // surface to UI so users can retry/re-transfer\n});","handlingStrategy":"retry","validationCode":"// before playing, confirm the SDK session is ready and premium-authorized\nif (!this.ready || this.unavailableReason) return; // don't attempt playback on a non-premium/unready device","typeGuard":"function isPlaybackErrorPayload(v: unknown): v is { message: string } {\n  return typeof v === \"object\" && v !== null && typeof (v as any).message === \"string\";\n}","tryCatchPattern":"player.addListener(\"playback_error\", ({ message }) => {\n  console.warn(\"[spotify-sdk] playback error:\", message);\n  this.retryCurrentPlaybackOnce().catch(() => this.emitError({ kind: \"playback\", message }));\n});","preventionTips":["Gate all playback on a verified Premium account and successful SDK init.","Re-transfer playback to this device before play attempts after idle periods.","Use browsers with EME/DRM (Widevine) support for Web Playback SDK.","Surface playback_error to the UI instead of only logging, so users can retry."],"tags":["spotify","playback-sdk","drm","streaming"],"backgroundTag":"upstream-api-error","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}