Partner API base path is /api/v1 on https://api.dcast.pro. This site documents the live surface; use the Quickstart QA curls to validate keys and routes.

DCAST in Lovable apps

Lovable builds the app; DCAST hosts, transcodes and delivers its video. Viewers get adaptive streaming on any device, authors can broadcast live, and the DCAST player can sell access to a video or a broadcast. Lovable writes the integration code itself from the knowledge text on this page: you describe the feature in the chat instead of writing the calls by hand.

What you need

  • A DCAST account: sign up at dcast.pro. Every plan works through the API, including the free one; storage, streaming hours and paid features follow your plan exactly as on the website.
  • No API key and no secret: the widgets and the public video list that the knowledge text uses work without one.
  • A Lovable project of any kind. DCAST needs no backend, no secret and no setting in it.

Add DCAST to your project

Lovable puts DCAST widgets into the page: your video library, an upload button and a live studio for you as the owner, and the player with paid access. The widgets run in the page and the public video list needs no key, so the knowledge text is the only thing to paste.

  1. Open Project settings → Knowledge and paste the knowledge text below. It is well under the 10,000-character limit of Lovable knowledge.
  2. Give Lovable your DCAST username in the chat and ask for the feature (examples below). Lovable adds the script https://dcast.tv/embed/dcast.js and the widget; there is no key to enter.

If you need server access

The widgets and the public list cover showing videos, uploading, going live and paid access. If your app needs server-side access to your account, use DCAST in Cursor or Claude Code: the DCAST site connector there gives the site access by itself.

Knowledge text

Copy the whole block. It tells Lovable how to show your library and videos, take uploads, go live and sell access with DCAST widgets, with no key in the app.

# DCAST video: how this app shows video, takes uploads, goes live and sells access

DCAST (dcast.pro) hosts, transcodes and delivers this app's videos and live streams, and runs the player with its paywall. Use DCAST for every video feature; do not store video files in the app's own storage and do not build a video player.

## Rules
- This app needs no API key, no secret and no server code for DCAST. Everything below runs in the page. If a step seems to need a key, the plan is wrong: use the page widget or the public list. Never ask the person to paste a key, never create a `DCAST_API_KEY` secret, never put any DCAST secret in code, in a `VITE_` variable or in the database.
- `<username>` is the DCAST username of the account that owns the videos (the channel name on dcast.tv). Ask the person for it once and keep it in one constant.
- Load the script once, in `index.html`: `<script src="https://dcast.tv/embed/dcast.js" async></script>`. It fills every element that carries one of the `data-dcast-*` attributes below with a DCAST frame that sizes itself. In a React app render the empty element and let the script mount it.
- Optional attributes on every widget: `data-lang="es"` (default: the page's `<html lang>`), `data-theme="light|dark|auto"`, `data-height` (starting height in pixels; the frame then follows its content).
- Never write player HTML or player addresses by hand: take them from the widgets below or from the `playback.embed` field of the public list. Do not invent attributes, endpoints or fields.
- Plan limits (storage, streaming hours, paid features) are the same here as in the DCAST cabinet; the widget shows the refusal to the person, so do not retry or hide it.

## 1. Show the whole video library
```html
<div data-dcast-library="<username>"></div>
```
A grid of the account's videos with search and the DCAST player inside; the viewer opens a video in the same frame. It shows only public videos that the author lists on the DCAST site. Add it to a page, a tab or a section; no other code is needed.

## 2. Show one video, or build the grid yourself
The public list needs no key: `GET https://api.dcast.pro/api/v1/channel/<username>/videos?page=1&limit=20` (limit up to 100; 60 requests per minute per IP, so call it from the browser of the visitor, one request per page view). It answers `{ "success": true, "data": { "videos": [...], "pagination": { "page", "limit", "total", "pages" } } }`. Each video has `id`, `title`, `description`, `duration`, `status`, `thumbnails` (posters), `publishedAt` and `playback.embed` (the player address, `null` while the video is not ready).

Show posters and titles, not players. When the visitor opens a video put `playback.embed` as the `src` of one iframe with `allow="autoplay; fullscreen; encrypted-media; picture-in-picture; payment"` and `allowfullscreen`, inside a 16:9 box; one player on the page at a time. Do not change the address.

A private, unlisted or paid video that is not in the public list: the author copies its code in the DCAST cabinet (the share menu of the video card, then Embed) and the person pastes that code into the page. Do not rewrite it.

## 3. Upload a video
```html
<div id="upload" data-dcast-upload="<username>"></div>
```
Only the owner of `<username>` can upload: the owner presses the button, signs in to dcast.tv in a pop-up window, picks a file and it goes straight from the browser to DCAST (resumable, any size). Visitors who sign in with another account are told it is not their channel, so put the widget on an owner page (an admin screen), not on a public page. React to the end of an upload with the DOM event `dcast:studio:uploaded` (`event.detail.videoId`) on the element; `dcast:studio:signed-out` tells that the owner signed out. Processing then runs on DCAST; the new video appears in the library and in the public list once it is ready.

## 4. Live stream
```html
<div id="studio" data-dcast-live="<username>"></div>
```
A camera and microphone studio: the owner signs in in a pop-up window, allows the camera and microphone and goes live to the channel from the browser. Put it on an owner page only. The element receives `dcast:studio:live-started` and `dcast:studio:live-stopped` (`event.detail.streamId`). For an OBS stream the owner creates it in the DCAST cabinet (the stream card shows the ingest address and the viewer embed code); the person pastes the viewer embed code from the card's share menu (Embed) into the page as an iframe and does not show the ingest address to viewers.

## 5. Paid access
The DCAST player takes the payment, so the app builds no checkout and does not need Stripe for this. The owner sets a price on a video or a stream card in the DCAST cabinet; the player shown by the library, by `playback.embed` and by the embed codes then shows the price, takes the payment and opens the video for the buyer. If the owner has no payout method connected yet, the cabinet asks for it first (dcast.pro).

## 6. Only the sites you allow
The account may limit which sites can show its player (cabinet embed settings). An empty list means every site. If the player refuses on this app, the owner adds this app's domain (`<app>.lovable.app` and any custom domain) there.

## 7. Server access
The widgets and the public list cover showing, uploading, live and paid access. If the app really needs server-side access to the DCAST account (a private catalog, uploads by visitors, webhooks), use DCAST in Cursor or Claude Code: the DCAST site connector there gives the site access by itself; nothing is copied by hand.

## Account
No DCAST account yet: https://dcast.pro/signup?utm_source=lovable&utm_medium=integration&utm_campaign=knowledge . Plan limits (storage, streaming hours, paid features) are the same in the widgets and in the cabinet.

What Lovable builds with it

FeatureDCAST calls
Video library with search and the player insidedata-dcast-library, GET /channel/{username}/videos
Resumable upload of files of any size straight from the browserdata-dcast-upload, dcast:studio:uploaded
Player with adaptive playbackplayback.embed
Live stream from the browserdata-dcast-live, dcast:studio:live-started
Paid access to a video or a broadcast, paid inside the playerplayback.embed

Example requests to Lovable

  • “Add a lessons page: I upload a video for each lesson to DCAST on an admin page, and students watch it in the DCAST player.”
  • “Add a Videos page that shows my whole DCAST video library; my DCAST username is NAME.”
  • “Add an owner page with a DCAST upload button and a button to go live from the browser.”

Who can do what

  • The app holds no DCAST key or secret. The upload and live widgets work only for the owner of the channel, who signs in to dcast.tv in a pop-up window, so put them on an owner page, not on a public one.

Support

Write to [email protected]. Plan limits and error codes are the same in the API and in the cabinet (see Errors and limits).