Hybrid Integration

Use ADN's API server-to-server to provision upload and play sessions, then pass session IDs to ADN web components.

Best For

SaaS products, paywalled content, and multi-tenant apps. Setup takes about 30 minutes.

Playing Tracks

Server-provisioned sessions with ADN's Player component.

Your server uses ADN's API (server-to-server) to provision play sessions — applying entitlement checks, subscription validation, etc. — then passes the session ID to ADN's Player component on the frontend. Your backend controls who can play; the component handles the UI.

1. Create an API Key

Go to Settings → API Keys and create an API Access key.

2. Create a Play Session (Server-Side)

const response = await fetch('https://api.audiodelivery.net/v1/play_session/collection', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    collection_id,
    variants: ['preview'],
    is_downloadable: false,
    expires_in: 3600 // session duration in seconds (default: 3600, min: 60, max: 86400)
  })
});

const { play_session_id, play_session, tracks } = await response.json();

Apply your business logic here — verify the user is logged in, check their subscription, validate purchases, etc.

3. Include ADN Web Components

<script type="module" src="https://components.audiodelivery.net/player.js"></script>

4. Pass Play Session to Client

<audiodn-player
  play-session-id="PLAY-SESSION-ID"
></audiodn-player>

5. User Playback

Users stream tracks within the session scope. Access is controlled by your backend while playback uses ADN's optimized Player component.

Uploading Tracks

Server-provisioned sessions with ADN's Uploader component.

Your server uses ADN's API (server-to-server) to provision upload sessions, then passes the session ID to ADN's Uploader component on the frontend. Your backend controls who can upload; the component handles the UI.

1. Create an API Key

Go to Settings → API Keys and create an API Access key.

2. Create an Upload Session (Server-Side)

const response = await fetch('https://api.audiodelivery.net/v1/upload_session', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    collection_id: 'COLLECTION-ID',
    expires_in: 3600 // session duration in seconds (default: 3600, min: 60, max: 86400)
  })
});

const { upload_session } = await response.json();
const { id, collection_id, expires_at } = upload_session;

3. Include ADN Web Components

<script type="module" src="https://components.audiodelivery.net/uploader.js"></script>

4. Pass Upload Session to Client

<audiodn-uploader
  upload-session-id="UPLOAD-SESSION-ID"
  accent-color="#ff00ff"
></audiodn-uploader>

5. User Upload Flow

Users upload files directly via the component. ADN automatically processes variants.

6. Optional: Webhooks

Enable a webhook under Settings → Webhooks for upload completion events.