Toflix Embed

Player API

Drop in a player

Pick a title, copy the iframe. Routes, flags, and events sit under Docs in the menu.

/embed/movie/315162
Idle 0 events
Open Docs

Player

Routes

Movies and series take a TMDB id. Anime takes an AniList id. Missing season or episode defaults to 1. Catalog pages stay on /movie/{id} — the player is always under /embed.

https://toflix.co/embed/movie/{tmdbId}
https://toflix.co/embed/tv/{tmdbId}/{season}/{episode}
https://toflix.co/embed/anime/{anilistId}/{episode}

Player

Iframe

Give the iframe a real box (width 100% and 16:9). Copy allow exactly — the * after autoplay and fullscreen is required if the player redirects.

<iframe
  src="https://toflix.co/embed/movie/315162?color=DC2626"
  width="100%"
  height="100%"
  frameborder="0"
  allowfullscreen
  allow="encrypted-media; autoplay *; fullscreen *"
></iframe>

Options

Flags

All opt-in. A missing key stays off, except color which falls back to red.

ParamWhereExampleWhat it does
colorAllDC2626Accent hex, no #.
progressAll120Start at this many seconds.
autoplayAlltrueStart with sound when a stream is found.
nextEpisodeTV, animetrueNext Episode control.
episodeSelectorTV, animetrueSeason / episode picker.
autoplayNextEpisodeTV, animetrueAdvance when the episode ends.

Options

Autoplay

Off by default. autoplay=true starts with sound when a stream is found. It never falls back to muted playback. The parent page must have had a user click, and the iframe must use allow="autoplay *".

Integrate

JSON

Confirm a title resolves before you render an iframe. CORS is open.

GET https://toflix.co/api/embed/movie/315162
GET https://toflix.co/api/embed/tv/1396/1/1
GET https://toflix.co/api/embed/anime/21/1

Integrate

Events

The player posts JSON strings to window.parent, plus the object form used by VidLink-style players. Ignore anything not from https://toflix.co.

window.addEventListener("message", (event) => {
  if (event.origin !== "https://toflix.co") return;
  const raw = event.data;
  const payload = typeof raw === "string" ? JSON.parse(raw) : raw;
  if (payload.event === "timeupdate") {
    // persist payload.currentTime
  }
});

No catalog, account, or watchlist in the embed. Keep continue-watching on your side and send progress when the user comes back.

Integrate

Examples

Copy a URL and paste it into the playground.

/embed/movie/315162?color=22C55E&progress=90
/embed/movie/315162?autoplay=true
/embed/tv/1396/1/1?nextEpisode=true&episodeSelector=true&autoplayNextEpisode=true
/embed/anime/21/1?color=FFFFFF&episodeSelector=true