# Paradym Player integration for coding agents · v1

Read this document when the site owner asks you to install Paradym Player. The human guides are at https://developers.paradym.tv/en/ and https://developers.paradym.tv/fa/. Read the live partner schema at https://developers.paradym.tv/agents/v1/openapi.json. API origin for this installation: https://api.paradym.tv. Read the schema again if the server rejects an example.

## Inputs and authorization

Identify the site, its exact origin, environment, movie ID, target platform and where the customer checks viewing rights. Discover the site's existing server-side secret manager. A site owner signs in at https://developers.paradym.tv/en/console?setup=agent, selects their existing site or creates a Free site, and reviews the environment and requested scopes. Wait until the agent is ready, then issue the one-use grant. If prompted, the owner confirms their password in the same window. The five-minute redemption window starts at issuance. A live site must first verify its DNS record. If the owner already installed a usable site key, reuse it. Public documentation supplies no credentials.

## Create one key for the authorized site

Use the provided grant as a Bearer credential for POST /partner/v1/agent/keys with JSON {"name":"Site integration"}. The successful response includes the one-time field secret. The grant binds the site, exact scopes and environment and can be redeemed once within five minutes. Pass the grant through the tool's secret injection or a private server terminal. Keep raw tokens, key responses and signed media URLs out of conversation transcripts, source control, browser code, logs, screenshots and tool output.

The included Python helper reads the grant with hidden terminal input or from PARADYM_AGENT_GRANT. Supply the trusted HTTPS API origin explicitly and an unused file path outside the web root and repository. It saves the issued secret with owner-only permissions and prints only status. Move the result to your site's secret manager as PARADYM_PLAYER_KEY. If issuance has an uncertain result, inspect the site's key inventory, revoke the abandoned key and ask the owner for a new grant. Expiry or a missing permission requires fresh owner authorization.

    python3 redeem-key.py --api-origin https://api.paradym.tv --name "Site integration" --out /private/path/paradym-player-key

Download the helper: https://developers.paradym.tv/agents/v1/redeem-key.py

## Implement on the customer's server

1. Configure PARADYM_API_ORIGIN=https://api.paradym.tv and the server key. Split archive publishing (assets:write) from launch issuance (playback:issue) when they run in separate services.
2. Register a stable customer asset with a playable HTTPS MP4 or HLS source. Replace sample hosts when testing a private installation.
3. Derive a pseudonymous viewer ID and authorized asset from the customer's own authenticated session. Check the site's entitlement policy on every launch. Grant guest access only according to the site's published policy.
4. Implement a same-origin POST launch endpoint, protect it with the site's normal request protections, return private/no-store, and test with its real page cache. Only the launch response reaches the browser.

```sh
curl --fail-with-body --request PUT "$PARADYM_API_ORIGIN/partner/v1/assets/demo-film" \
  --header "Authorization: Bearer $PARADYM_PLAYER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "First film",
    "source_type": "mp4",
    "source_url": "https://developers.paradym.tv/assets/first-film.mp4",
    "subtitles": [
      {"language":"fa","label":"فارسی","url":"https://developers.paradym.tv/assets/fa.vtt"}
    ]
  }'
```

```js
// Inside your authenticated movie route on the customer server
const viewer = await requireViewer(request);
await requireFilmAccess(viewer, film);
const result = await fetch(process.env.PARADYM_API_ORIGIN + '/partner/v1/playback-sessions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + process.env.PARADYM_PLAYER_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    asset_id: film.externalId,
    viewer_id: viewer.opaqueId,
    origin: process.env.PUBLIC_SITE_ORIGIN
  })
});
if (!result.ok) throw new Error('Playback authorization failed');
return Response.json(await result.json(), {headers:{'Cache-Control':'private, no-store'}});
```

A runnable customer server and page for one explicitly public film are available at https://developers.paradym.tv/examples/public-film.mjs. Run with Node 22, SITE_ORIGIN, PARADYM_API_ORIGIN, PLAYER_ORIGIN and a server-side PARADYM_PLAYER_KEY. For a members-only film, replace the example’s public-film policy with the actual membership check.

## Mount on a website

```html
<div id="film"></div>
<script src="https://player.paradym.tv/sdk/v1/player.js"></script>
<script>
  const player = ParadymPlayer.mount(document.querySelector('#film'), {
    locale: 'en',
    launch: async () => {
      const response = await fetch('/movies/demo-film/launch', {
        method: 'POST', credentials: 'same-origin', cache: 'no-store'
      });
      if (!response.ok) throw new Error('Cannot open this film');
      return response.json();
    }
  });
  // Call player.destroy() when removing the player.
</script>
```

For enrolled playback, pin https://player.paradym.tv/sdk/v1/player-1.1.0.js and use the matching player-1.1.0.d.ts declaration. The progress event and getProgress() return {mountId, positionSeconds, durationSeconds, reason}. Await ready before applying saved resume with seek(). Take the latest snapshot before destroy() or page exit. Save it on the cadence and lifecycle events already used by the customer. Course completion stays with the customer's server rules.

For WordPress install https://developers.paradym.tv/downloads/paradym-player.zip. Register the asset, configure the site key server-side, explicitly authorize public or member playback, then add [paradym_player asset="demo-film"] or the Paradym Player block. Read https://developers.paradym.tv/en/wordpress for the membership hook and configuration.

## Open a private party on Paradym

For a Watch in a Paradym Party button, use https://developers.paradym.tv/en/watch-in-paradym and the example at https://developers.paradym.tv/examples/watch-in-paradym.mjs. The site owner enables this feature and chooses the guest policy in Test or verified Live. Request only the parties:launch scope if the server only needs room handoffs. Register a published MP4 and derive the viewer ID and entitlement on the site's server. POST /partner/v1/watch-party-launches and use the returned launch_url in the top-level browser. For individual guest authorization, implement /.well-known/paradym-party/join and call /partner/v1/watch-party-launches/guest/inspect with the opaque request to retrieve the exact asset and revision. Authorize the signed-in guest for that edition before calling /partner/v1/watch-party-launches/guest. Exercise room approval, access denial and renewed MP4 playback with separate members before reporting success.

## Verify the installation

Run on the registered customer origin. Play, pause and seek. Check an authorized viewer and a denied viewer. Confirm the latter cannot obtain a grant. Confirm a copied launch grant cannot be reused, the server key is absent from page HTML and network responses, and the site's console records the test start. If subtitles are supplied, switch tracks and inspect a Persian cue. Deliver the files changed, environment, tests and remaining errors to the owner without exposing secret values. For 401 inspect expiry or revocation; for 403 inspect scope/origin/ownership; for 429 wait before retrying.

## Operation boundary

The delegation authorizes one key with the owner's chosen scopes. Site, credential, domain, plan and billing administration use their own authenticated surfaces. Read the current schema for available operations. Do not invent endpoints, broaden permissions, or mark a WordPress or player integration complete from an HTTP success alone.
