npm.io
0.3.28 • Published 2d agoCLI

synxed-sdk

Licence
Version
0.3.28
Deps
6
Size
684 kB
Vulns
0
Weekly
0

Synxed SDK

Add Music to your website, Game or App in a few minutes — Stream Licensed Music, Create and manage playlists, Listen to live radio, voice commands to stream songs or create custom playlist, and a ready-made player UI

Synxed has already paid for the right to make that music available, you do not need to pay any license fees, we handle that for you.

npm version

What you need

  1. A Synxed API key (from your Synxed developer account https://portal.synxed.com).
  2. Our API URL is https://api.synxed.com.
  3. A playlist code, Single Song, AI DJ mode or choose live radio.

Install

npm install synxed-sdk

Easiest setup — built-in player

This adds a floating music bar to your page. No React or special framework required.

Play a playlist
<script type="module">
  import { SynxedWebPlayer } from "synxed-sdk";

  SynxedWebPlayer.mount({
    apiKey: "YOUR_SYNXED_API_KEY",
    serverUrl: "https://api.synxed.com",
    source: { type: "playlist", playlistCode: "sxpl_YOUR_CODE" },
  });
</script>
Play one song

Use the songId copied from the Synxed developer portal.

SynxedWebPlayer.mount({
  apiKey: "YOUR_SYNXED_API_KEY",
  serverUrl: "https://api.synxed.com",
  source: { type: "song", songId: "SYNX_EX_SONG_ID" },
});
Play live radio
SynxedWebPlayer.mount({
  apiKey: "YOUR_SYNXED_API_KEY",
  serverUrl: "https://api.synxed.com",
  source: { type: "radio" },
});
Put the player inside your own box
SynxedWebPlayer.mount({
  container: document.getElementById("my-player"),
  apiKey: "YOUR_SYNXED_API_KEY",
  serverUrl: "https://api.synxed.com",
  source: { type: "playlist", playlistCode: "sxpl_YOUR_CODE" },
});

Player sizes

Mode What it looks like
wide Bar across the bottom (default)
mini Small round DJ button
large Bigger card with visualizer
SynxedWebPlayer.mount({
  apiKey: "...",
  serverUrl: "...",
  source: { type: "playlist", playlistCode: "sxpl_..." },
  mode: "mini",
});
Set a custom wide-player width

The default wide player is capped at 560px. Set width to any valid CSS width value when you need a different size.

SynxedWebPlayer.mount({
  apiKey: "...",
  serverUrl: "...",
  source: { type: "playlist", playlistCode: "sxpl_..." },
  width: "720px", // or: "min(90vw, 820px)"
});

Move the player on screen

SynxedWebPlayer.mount({
  apiKey: "...",
  serverUrl: "...",
  source: { type: "radio" },
  position: { placement: "top-left", offsetX: 16, offsetY: 16 },
  draggable: true,
});

Match your brand colors

SynxedWebPlayer.mount({
  apiKey: "...",
  serverUrl: "...",
  source: { type: "playlist", playlistCode: "sxpl_..." },
  theme: {
    accent: "#22c55e",
    background: "#0a0a0a",
  },
});

border, liveDot, and glow follow accent by default. Override them only when you need separate colors.

Talk to the DJ (voice playlists)

Hold the Synxed DJ avatar (the spinning circle) and say what you want to hear — for example “play me drake songs for workout”.

  • Tap the DJ → play or pause the music.
  • Hold the DJ → speak your request; release when done (or stop talking and it sends automatically).
  • While you speak, the DJ icon switches to the AI listening view.
  • Music pauses while you talk and can resume when you tap again.

To turn voice off:

SynxedWebPlayer.mount({
  enableVoice: false,
  // ...other options
});

Skip button and ads

  • During normal playback, the skip button jumps to the next song.
  • During an ad, the same button shows a short countdown (about 5 seconds), then you can skip the ad.
  • After the ad, the skip button works again for the next song.

Build your own UI (optional)

If you want full control over buttons and layout, use SynxedPlayer instead of SynxedWebPlayer:

import { SynxedPlayer } from "synxed-sdk";

const player = new SynxedPlayer({
  apiKey: "YOUR_SYNXED_API_KEY",
  serverUrl: "https://api.synxed.com",
  autoConnect: true,
  // AI voice is enabled by default. Set this to false to ship music only.
  voice: { enabled: false },
});

await player.playSong({ songId: "SYNX_EX_SONG_ID" });
// or
await player.playPlaylist({ playlistCode: "sxpl_YOUR_CODE" });

document.getElementById("play").onclick = () => player.resume();
document.getElementById("pause").onclick = () => player.pause();
document.getElementById("skip").onclick = () => player.skip();
Voice with your own buttons
const dj = document.getElementById("dj-avatar");

dj.addEventListener("pointerdown", () => player.beginVoiceHold());
dj.addEventListener("pointerup", () => player.endVoiceHold());

Clean up when leaving the page

const ui = SynxedWebPlayer.mount({
  /* ... */
});

// When your app unmounts or navigates away:
ui.destroy();

Radio “now playing” title

For radio, you can show the current song name on your own label:

import { fetchRadioNowPlaying } from "synxed-sdk";

const info = await fetchRadioNowPlaying("https://api.synxed.com");
if (info) console.log(info.title);

Poll every 10–15 seconds to keep the title fresh.

License

Copyright Synxed.com

Keywords