# Quickstart

## Prerequisites

Before integrating the Webplayer, ensure your project meets the following requirements:

* [React](https://github.com/facebook/react/blob/main/CHANGELOG.md#1800-march-29-2022) version 18 or higher
* [TypeScript](https://github.com/microsoft/TypeScript/releases/tag/v5.0.2) version 5 or higher

## Installation <a href="#id-1-installation" id="id-1-installation"></a>

You can install the Webplayer using npm or yarn. Choose your preferred package manager and run the following command:

{% tabs %}
{% tab title="npm" %}
`npm install @syncstreamai/syncstream`
{% endtab %}

{% tab title="yarn" %}
`yarn add @syncstreamai/syncstream`
{% endtab %}
{% endtabs %}

## Set Up Your App with Recoup's Webplayer

After installing the package, import the `SyncstreamProvider` component into your project and wrap your app with it. The SyncStreamProvider should wrap any component or page that will use SyncStream. It is recommended to place it as close to the root of your application as possible.

\
**Example** [**NextJS**](https://nextjs.org/) **or** [**Create React App**](https://create-react-app.dev/)**:**

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

```tsx
'use client';

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

export default function App() {
  return (
    <SyncstreamProvider
      campaignId="EXAMPLE_CAMPAIGN_ID"
      signInRequired
    >
      <OneTap spotifyDefaultLink="spotify:artist:2hlmm7s2ICUX0LVIhVFlZQ" />
    </SyncstreamProvider>
  );
}
```

{% endtab %}

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

```tsx
import React from 'react';
import { OneTap, SyncstreamProvider } from "syncstream-ai";
import "syncstream-ai/dist/index.css";

export default function App() {
  return (
    <SyncstreamProvider
      campaignId="EXAMPLE_CAMPAIGN_ID"
      signInRequired
    >
      <OneTap spotifyDefaultLink="spotify:artist:2hlmm7s2ICUX0LVIhVFlZQ" />
    </SyncstreamProvider>
  );
}
```

{% endtab %}
{% endtabs %}

## Property Descriptions

**SyncstreamProvider Component**

In the examples above, notice that the `SyncstreamProvider` component takes one property:

| Property       | Description                                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| campaignId     | (Required) Your campaign ID assigned by [Recoup](https://chat.recoupable.com/).                                                       |
| signInRequired | (Optional) Use this to add a blur overlay and prevent the user from accessing the site without first connecting a streaming provider. |

**OneTap Component**\
\
In the examples above, notice that the `OneTap` component takes two properties:

| Property           | Description                                                                                                                                                                                                                                                                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| spotifyDefaultLink | <p>Optional. </p><ul><li>Spotify URI of the context to play. Valid contexts are albums, artists & playlists. <code>"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"</code></li><li>A JSON array of the Spotify track URIs to play. For example: <code>\["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]</code></li></ul> |

The URI, or Uniform Resource Indicator, is a unique code that identifies a specific element on Spotify or Apple Music, such as an artist, album, track, playlist, or user. \
\
[Click here](https://spotiurl.com/) to convert any Spotify song or album URL into a URI. Please refer to the [Spotify documentation](https://developer.spotify.com/documentation/web-api/reference/start-a-users-playback) for more information about this.

## Just `use Recoup's Webplayer`! 🎉 <a href="#id-4-just-useprivy" id="id-4-just-useprivy"></a>

Once you've wrapped your app with the SyncstreamProvider, you can now use it throughout your components and pages via the `OneTap`!


---

# Agent Instructions: 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:

```
GET https://webplayer.recoupable.com/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
