> For the complete documentation index, see [llms.txt](https://webplayer.recoupable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://webplayer.recoupable.com/less-than-onetap-greater-than/spotify.md).

# Spotify

The `<OneTap />` component provides Spotify services for Premium & Free subscribers.

## Spotify Premium User

Spotify Premium users can enjoy the Recoup Webplayer with their Spotify account after signing in.

{% tabs %}
{% tab title="NextJS" %}

```typescript
'use client';

import { OneTap, SyncstreamProvider } from "@syncstreamai/syncstream";
import "@syncstreamai/syncstream/dist/index.css";

export default function App() {
  return (
    <SyncstreamProvider
      clientId="EXAMPLE_CLIENT_ID"
      signInRequired
    >
      <OneTap 
        spotifyDefaultLink="spotify:album:1HOMjYmPvDpCNbb44JnFaa" 
        spotifyFreeAudioUrl={"https://boa-v2.vercel.app/audio/song.mp3"}
        spotifyStartIndex={18}
      />
    </SyncstreamProvider>
  );
}
```

{% endtab %}

{% tab title="Create React App" %}

```typescript
import React from 'react';
import { OneTap, SyncstreamProvider } from "@syncstreamai/syncstream";
import "@syncstreamai/syncstream/dist/index.css";

export default function App() {
  return (
    <SyncstreamProvider
      clientId="EXAMPLE_CLIENT_ID"
      signInRequired
    >
      <OneTap 
         spotifyDefaultLink="spotify:album:1HOMjYmPvDpCNbb44JnFaa" 
         spotifyFreeAudioUrl={"https://boa-v2.vercel.app/audio/song.mp3"}
         spotifyStartIndex={18}
      />
    </SyncstreamProvider>
  );
}
```

{% endtab %}
{% endtabs %}

\
Please refer to the [Spotify documentation](https://developer.spotify.com/documentation/web-api/reference/start-a-users-playback) to learn more about this.

| Property            | Description                                                                                                                                                                                                                                                                                 |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| spotifyDefaultLink  | <p>Optional. </p><ul><li>Spotify URI of the context to play. Valid contexts are albums, artists & playlists. </li><li>A JSON array of the Spotify track URIs to play. For example: <code>\["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]</code></li></ul> |
| spotifyFreeAudioUrl | Optional. Audio for Spotify `free` users.                                                                                                                                                                                                                                                   |
| spotifyStartIndex   | Optional. Track number to begin with from the selected media in spotifyDefaultLink. Only applicable if spotifyDefaultLink is an album or a playlist.                                                                                                                                        |

## Spotify Free User

We provide a music player for users without a Spotify subscription as well.\
If you have non-premium users, you can pass in a custom audio file to play.

Example:

```typescript
<OneTap 
    contextUri="spotify:artist:0TnOYISbd1XYRBk9myaseg" 
    spotifyFreeAudioUrl={"https://boa-v2.vercel.app/audio/song.mp3"}
/>

```

| Property            | Description                           |
| ------------------- | ------------------------------------- |
| spotifyFreeAudioUrl | <p>Optional. music audio URL.<br></p> |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://webplayer.recoupable.com/less-than-onetap-greater-than/spotify.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
