← HTX Media

Player contract & testing

How TVs get content, how to test end to end on two devices, and what browsers can't guarantee.

Test from two devices

  1. Publish the app, and use the published address on both devices (the editor preview can ask TVs to sign in to Lovable).
  2. Device A (laptop/phone): sign in at /auth. The first account created becomes the admin.
  3. Media → upload a JPEG and an MP4 (H.264/AAC). Approve both.
  4. Playlists → Houston Demo Loop → add both, set the image to 8 seconds → Publish to screens.
  5. Screens → Home Fire TV Test → Generate 15-minute code (or Create TV link and copy it).
  6. Device B (Fire TV, Silk browser): open /tv, type the code with the remote and press Connect. Or open the copied TV link directly.
  7. Press Start Playback for fullscreen. Press Enable Audio if you want sound. Any remote button brings the controls back.
  8. On Device A, reorder the playlist and publish again. Within ~20 seconds the TV switches once the current item finishes. The screen page shows last seen, now playing and errors.
  9. Press Revoke on Device A: the TV stops and asks for a new pairing code at its next check (~20s).

Browser limitations

Manifest contract (v1)

Designed so a future Roku BrightScript channel can use the same endpoints with roUrlTransfer + ParseJson.

GET /api/public/v1/manifest

Auth: Authorization: Bearer <device token> (or ?token=). 401 means the token is invalid or revoked — stop playback and show pairing.

{
  "schema": "yalife.manifest.v1",
  "screen": { "id": "8c1f…", "name": "Home Fire TV Test" },
  "version": "22222222.4.k3j9a1",
  "generated_at": "2026-12-03T15:20:00.000Z",
  "url_expires_at": "2026-12-03T21:20:00.000Z",
  "poll_interval_seconds": 20,
  "heartbeat_interval_seconds": 30,
  "items": [
    {
      "item_id": "b0e…", "media_id": "51a…",
      "type": "image", "title": "Annie B's lunch special",
      "url": "https://…signed…", "mime_type": "image/jpeg", "size_bytes": 482113,
      "duration_seconds": 10, "play_to_end": false,
      "start_at": null, "end_at": "2026-12-31T23:59:00.000Z"
    },
    {
      "item_id": "c9d…", "media_id": "77f…",
      "type": "video", "title": "Lard & Have Mercy promo",
      "url": "https://…signed…", "mime_type": "video/mp4", "size_bytes": 18220311,
      "duration_seconds": null, "play_to_end": true,
      "start_at": null, "end_at": null
    }
  ]
}

POST /api/public/v1/heartbeat

Every heartbeat_interval_seconds. Updates last seen and stores events. Event types: startup, play_start, error, offline, online (max 100 per call).

POST /api/public/v1/heartbeat
Authorization: Bearer <device token>
Content-Type: application/json

{
  "version": "22222222.4.k3j9a1",
  "current_media_id": "77f…",
  "user_agent": "Roku/DVP-12.5",
  "events": [
    { "event": "play_start", "media_id": "77f…", "at": "2026-12-03T15:20:05Z" },
    { "event": "error", "media_id": "51a…", "message": "decode failed", "at": "2026-12-03T15:20:15Z" }
  ]
}

POST /api/public/v1/pair

Body { "code": "K7M2QX" } → { "token": "…" }. Codes are single use and expire after 15 minutes. 404 = invalid or expired.

Deferred

Payments (Stripe), venue payouts, music licensing and a native Roku channel are out of scope for this MVP.