On air · Self-hosted OTT video platform

One platform to stream, create & earn

BreakTV runs breaktv.asia: uploads transcoded to an adaptive HLS ladder with cover frames, soundtracks and AI-designed thumbnails, shorts, movies and series, live streaming from the browser or OBS, a creator studio, a wallet with Bakong KHQR top-ups, paid videos and memberships, a video ad server and a Telegram bot and Mini App. Every stream is shielded at the Cloudflare edge, and it all runs on the web and as an installable app, in English and Khmer.

7HLS renditions
280+REST endpoints
30Admin pages
175Admin settings
51Database tables
2Languages (EN/ខ្មែរ)
Features

Everything a video service needs, in one platform

A complete OTT stack — from a raw upload to a paid, adaptive stream on every screen.

Video & HLS Engine

Resumable chunked uploads, five cover frames to pick from, soundtracks from a music library, FFmpeg transcoding to an adaptive HLS ladder from 240p to 4K, hover previews, seek-bar storyboards and MP4 downloads.

Shorts

A full-screen, swipeable vertical feed like Reels, where only the short in view plays and the next one loads ahead. Portrait uploads up to 60 seconds become shorts automatically, with their soundtrack's name on screen.

Movies & Series

Movie genres, series grouped into seasons and episodes, “Shows” rows on the home page, and a free 60-second trailer in front of paid titles.

Live Streaming

Go live from a browser or phone camera, share a screen, or stream from OBS through Cloudflare Stream (RTMPS or SRT). Live chat and viewer counts, and the recording becomes a normal video when the stream ends.

Video Ad Server

Ad breaks before, half-way through and after videos and inside shorts, self-serve campaigns, VAST 4.1 tags for other players and a portal for advertisers.

Community

Channels with subscriptions and a notification bell, threaded comments with pins and reactions, community posts, articles, playlists and real-time direct messages.

Creator Studio

Analytics per video — by day, country and platform — comment moderation, subtitles, in-video cards, scheduling, geo-blocking, age limits and pricing.

Wallet & Payouts

A wallet topped up with Bakong KHQR, bank receipts or Telegram Stars; Pro plans and memberships that can renew from it; videos for sale or rent, donations, points and creator withdrawals.

Telegram Bot & Mini App

The whole site inside Telegram, plus a bilingual bot: search, inline mode, account linking, notifications, channel auto-posts and Stars top-ups.

AI Thumbnail Designs

The uploader picks a frame and a style, and Workers AI repaints it as a wide cover and a tall poster: Gemma 4 writes the brief, FLUX.2 paints it. The frames stay, so the uploader can switch back at any time.

Download Protection

Every stream plays from Ed25519-signed links that expire in ten minutes, and the Cloudflare edge checks each request for the site's player rather than a download tool. Segments are handed out in twenty-second windows, no faster than watching.

Stories & Discovery

Trending, latest, most viewed, movies, shorts, live and every category open as full-screen stories, and every thumbnail plays its preview. Search reads Khmer and English, with recent searches kept on the device.

What's New

Recent Updates

The latest work shipping to breaktv.asia — newest first.

6 Dec 2026Latest
Docs

These docs move to doc.breaktv.asia

This page now has an address of its own, doc.breaktv.asia, served by Cloudflare straight from the edge as static files, so it opens fast and never depends on the video server. It also gains two sections: Infrastructure, which follows a request from the visitor to the server and back, and Pipelines, which follow a video from upload to screen, a live stream, an AI design and a new version of the site on its way out. Old links to breaktv.asia/doc lead here.

6 Dec 2026
Platform

The website and the installable app

BreakTV now focuses on the website and the app you install from it (PWA). The old Android and iOS apps, which wrapped the website, are retired along with their code, to make way for new native apps built from scratch later. Nothing changes on the site: on a phone, use the browser or install BreakTV from its menu.

5 Dec 2026
Accounts

Sign in with Google or Telegram

The sign-in page can offer Google and Log In With Telegram next to the password, once the site's Google client and Telegram Client ID are set in Admin → Settings. A Google address whose account has a confirmed e-mail signs in to that account; a new one makes a new account. Accounts with two-step sign-in are still asked for their code.

5 Dec 2026
Design

A glass card for signing in

Every sign-in page — sign in, create an account, forgotten password and the rest — now shares one frosted-glass card over a dark backdrop, on computers and phones.

4 Dec 2026
Design

A new BreakTV look on computers

On computers the BreakTV theme gets a menu down the left side, a banner carousel and framed poster cards with a “See all” button on each row, under the featured coverflow. The round navbar buttons sit in a pill and the one in use opens out to show its name, and titles and descriptions are a little smaller, so more fits on the screen. Tablets and phones keep their layouts.

4 Dec 2026
Security

Download protection: a video loads no faster than it plays

A download program written against BreakTV took whole videos in seconds: it opened the watch page in a real browser and recorded what the player loaded. Videos now reach the player in stretches of twenty seconds, and the server hands them out only about as fast as a video plays. Watching is unchanged, at double speed and when you skip around too. A program that forces the player ahead, or copies its requests, now gets a video as slowly as watching it. A tab left open since before this update reloads itself once.

3 Dec 2026
Security

Download protection: videos play in the player and nowhere else

Every video now plays through links that last ten minutes and that only the player on BreakTV can use. Download tools such as yt-dlp, ffmpeg and download managers, browser extensions that grab videos, and a link pasted into another program are refused (HTTP 403). A copied link stops working within minutes, and a link made in one country does not open in another. Watching is unchanged: the player renews its link by itself. The Download button still works on videos whose creator allows it. Admins can switch the protection off or on in Settings → Security. It cannot stop a screen recording.

3 Dec 2026
Studio

Edit a card you already made

Each card in Studio now has a pencil button. It puts the card back in the form as you typed it: its link or video, title, times, place, colours and picture. Change what you need and press Save: the card keeps its place in the list. Its picture stays unless you remove it or choose a new one. Cancel leaves the card as it was.

3 Dec 2026
Watch page

Website cards get their own picture, and cards stay up as long as you set

In Studio, a card now asks how long to stay on the player (“Show for”, in seconds) instead of the second it should end at, and says when it will be on screen, from 0:50 to 1:40 for instance. Before, an end written as a length (Show from 50, Until 50) left the card up for only 3 seconds. A website card can bring its own picture, and shows on the player as a square: the picture, its title over the foot in the card’s colours, and a corner badge for opening the site. Cards for videos keep their rounded pill.

3 Dec 2026
Interface

Previews on phones: hold for a second, or drag

On phones, a picture plays its preview when you hold it for a second, or when your finger drags over it as you scroll a row or the page. A touch shorter than a second is a tap and opens the video as before, even a slightly slow one that some phones take for a long press.

3 Dec 2026
Interface

Video previews on every thumbnail

Point at any video’s picture and its short, silent preview plays: on the home page, in rows and grids, in search, in the watch page’s lists, in playlists, in the library and in the featured carousel. On phones, touch and hold a picture to play it. The preview keeps going after you lift your finger, until you scroll on or hold another, and a quick tap still opens the video as before. One preview plays at a time, and none while your phone is saving data.

3 Dec 2026
Watch page

Cards on the player open their video in a pop-up

The cards a creator adds in Studio now show on the player as a rounded pill: the video’s thumbnail with a play button on it, then its title, in the colours the creator chose. A card for a video, on BreakTV or on YouTube, plays it in a pop-up player that grows out of the card, while the video you were watching waits and carries on when you close it (✕, Esc, or a tap beside the video). The ↗ button opens the video’s own page, and a card for any other website still opens it in a new tab. On phones the cards are smaller, and two cards never cover each other.

2 Dec 2026
App

New versions with one reload

The “A new version is ready” notice is gone. A new version of BreakTV now takes over by itself in the background: one reload of the page (or a pull down to refresh in the app) always shows the newest version, with no notice and no second reload.

2 Dec 2026
Studio

Card times can be set on computers again

On a computer, the studio’s edit page left a card’s “Show from (seconds)” and “Until (seconds)” fields no room to type in. The card form now lays itself out by the width it has: one field per row in the narrow side column.

1 Dec 2026
Uploads

Site updates no longer fail uploads

A video still being processed when the site updated could fail, and its upload was deleted. Now it simply starts processing again from the same file after the update, and updates that only change the pages don’t interrupt it at all.

1 Dec 2026
Phones

Live as stories

On phones, the live page becomes stories: “Go live” for those who may stream, the streams on air as a row you swipe through (each saying in red how long it has been on, with LIVE at its foot) or a word that nobody is live, then the recordings of past streams two across, newest first, more coming as you scroll. Past streams are new to the live page.

1 Dec 2026
Phones

Shorts as stories

On phones, the shorts page becomes stories: the newest shorts as a row you swipe through, each saying how old it is in its corner, the most viewed as a second row (their views in the corner, the top three in red), then the rest two across, more coming as you scroll. Tap a story to watch it full screen and swipe on as before; back brings you to the stories. A link to a short still opens it full screen straight away, and tablets and computers keep the full-screen player at /shorts.

1 Dec 2026
Phones

Movies as stories

On phones, the movies page becomes stories: the genres as pills on top (they narrow everything below), the newest movies as a row you swipe through, the most viewed as a second row once there are more movies than one row holds, then the rest two across, more coming as you scroll. A paid movie shows its price in its corner; a free one shows how old it is (or its views, among the most viewed).

1 Dec 2026
Phones

Most viewed as stories

On phones, the most viewed page becomes a ranking in stories: the eight most viewed videos of all time as a row you swipe through, each with its views in its corner (the top three in red), the most viewed shorts as a second row, then the rest two across, more coming as you scroll. On trending, the “Most viewed” row now leads to this page, and screen readers read a story’s corner badge in full words (“21 hours ago”, “23 views”).

1 Dec 2026
Phones

Latest as stories

On phones, the latest page becomes stories by time: the eight newest videos as a row you swipe through, each saying how old it is in its corner, in red for its first day, the newest shorts as a second row, then everything earlier two across, more coming as you scroll. On every stories page the preview now plays on the first story that has one, and a row with nothing to play (embedded videos) leaves the turn to the next row.

1 Dec 2026
Phones

Trending as stories

On phones, the trending page becomes a ranking in stories: the week’s eight best as a row you swipe through, numbered #1, #2… (the one at the front plays its preview), the trending shorts as a second row, then the rest of the ranking two across from #9, more coming as you scroll. A week with no recent views shows the most viewed videos instead, under that name, and a week whose ranking fits in the first row gets the most viewed as a row beneath it.

1 Dec 2026
Phones

Search as stories

On phones, the search page now shows your recent searches as pills you tap to search again (kept on that phone, with Clear) before you type anything, then a “Trending now” row and a “Browse categories” row of stories. Once you search, the eight best results are a row of stories you swipe through (the one at the front plays its preview) and the rest are stories two across, more coming as you scroll. The tabs and filters stay as they were.

1 Dec 2026
Address

BreakTV moves to breaktv.asia

The site now lives at breaktv.asia. Old links to ott.breaktv.asia and www.breaktv.asia open the same page on breaktv.asia, and the Android and iOS apps keep working as before. If you added the app to your home screen from the old address, add it again from breaktv.asia; you sign in once more on the new address.

1 Dec 2026
Phones

All categories as stories

On phones, the categories page opens with an “All categories” row you swipe through: every category as a story, the busiest first, with its most watched video as the picture and preview, its name over the top and its channels’ faces and number of videos over the foot. A category with no videos yet gets drawn art in its own colour, with a picture for what it is about. Below, a row of the newest videos of each category that has some, its title leading to the category. One preview plays at a time, in the row nearest the top.

30 Nov 2026
Phones

Each category as stories

On phones, each category page now opens with a “Trending now” row you swipe through sideways: tall 3:4 stories (the video’s AI poster, or its thumbnail) with the title over the top and the channel’s picture, name and length over the foot. The story at the front plays its silent preview while the row is on screen (not when the phone asks to save data or to reduce motion). Below, all of the category’s videos as stories two across, newest, trending or most viewed first. A category nobody has watched lately shows its newest instead. Long lists everywhere load more by themselves again when you scroll to the end.

30 Nov 2026
Phones

The phone’s navigation becomes a notch

On phones, the bar across the top (menu, BREAKTV, search) becomes an island hanging from the top edge of the screen, its dark colour curving into the edge on both sides. It holds the logo, the page you are on, search and your menu (your picture, with a red dot when something is unread). Tap the page’s name and the main pages drop out of it — Home, Movies, Shorts, Trending, Live, Categories, Subscriptions and My list — over a dimmed page, the one you are on marked in red. It stays at the top as you scroll, reaches up under the status bar of the installed app, and every page has it but Shorts.

30 Nov 2026
PWA

BreakTV installs like an app on phones

On Android, BreakTV now offers to install itself once you have looked around a little: the install sheet shows screenshots of the app, and the menu keeps Install the app at the top. On iPhone and iPad the same card and menu row show how to add it from Safari’s Share button, and inside the Facebook, TikTok or LINE browser how to open it in a real browser first. Installed, it opens full screen with the new BreakTV icon; a long press on the icon goes straight to Shorts, Search, Subscriptions or Upload, and a video shared from the phone’s gallery opens the upload page with it (Android). The lock screen and notification shade show what is playing, with play, pause, skips and Next, and the icon shows unread notifications. Offline, the app says so and reconnects by itself, and an app left open looks for a new version every half hour.

30 Nov 2026
Admin

AI designs for bulk imports

Admin → Bulk import can now design the thumbnails of the videos it imports: tick “Design the thumbnails with AI” and pick a style. Each design starts from the picture the video comes with (YouTube’s thumbnail, for example), right after the import; a download that has no picture is designed from its frames once it is in. Pictures are only fetched from public addresses, and a design is asked for again when Workers AI is slow to answer.

30 Nov 2026
Uploads

Pick a style for the AI design

When you tick “Design it with AI” on the upload page, eight styles now appear under it, each with a preview: Auto (the AI picks the look that suits your video), Cinematic, Vibrant, Dramatic, Romantic, Vintage, Illustrated and Bright. The design follows the style you pick, in both shapes. In Studio, Design again opens the same choice, starting from the style the last design used.

30 Nov 2026
Studio

Subtitles and cards can be added in Studio again

On a video's details page in Studio, the buttons that add subtitles and cards (links shown while the video plays) only reloaded the page and added nothing. They work again, without reloading the page, so unsaved changes to the details stay where they were.

30 Nov 2026
Uploads

Thumbnails designed by AI

When you upload a video you can now tick “Design it with AI”. Once you publish, Cloudflare’s AI looks at the frame you picked and at the title — Khmer titles included — and repaints the frame as polished cover art, without the lettering, logos or watermarks the frame had: a wide picture for phones and the watch page, and a tall poster for the lists on computers. It takes under a minute. Studio shows both, and you can go back to a frame, or design again from another one, at any time. Admins switch it on, choose who may use it and set a daily limit in Admin → Settings → AI thumbnails.

30 Nov 2026
Interface

Video lists on computers become rows of posters

On computers, the home page now lists videos as rows of tall posters with round corners under plain titles, each row running to the edge of the screen — no more red-tabbed boxes. Each poster shows its title at the foot; point at it and its details appear: length and views, the release date, or the time left to watch. Arrows at the sides of a row scroll it a screen at a time. The list pages — Trending, Latest, Movies, a category, your library and a channel's videos — show the same posters in a grid, with the ⋮ menu in the corner. Phones keep their own layout.

30 Nov 2026
Interface

The Khmer menu in Noto Sans Khmer

On computers, the menu at the top now shows its Khmer labels in Noto Sans Khmer, like the rest of the site's Khmer text. Before, they used whichever Khmer font the computer had (Khmer Sangam MN on a Mac, for example), so they looked different from the text around them. The English menu is unchanged.

29 Nov 2026
Interface

A new logo: a play button in a square

Where the site shows its own mark — the header on computers, the sign-in page, the loading screen and these docs — the red tile with a white triangle is now a play button in a square, drawn in the same red. Point at it and it draws itself: the square traces its outline, then the play button pops up in the middle. People who turn motion down in their system settings see it still. The app icon and the browser-tab icon stay as they were.

29 Nov 2026
Interface

A liquid-glass menu on computers

On computers, the menu at the top — Home, Movies, Shorts, Trending, Live and Subscriptions — is now a pill of glass with a drop of water marking the page you are on. Pick another page and the drop flows over to it, splitting into droplets on a long jump and merging back with a ripple; the pointer lifts the surface a little, and each icon plays its own small scene when tapped. On pages that are not in the menu, such as a video or a channel, there is no drop. On narrower screens the menu shows its icons only.

29 Nov 2026
Admin

A new Dashboard for the admin

On computers and phones, the admin's Dashboard has a new look: a greeting with a year picker and a user search, then five overview numbers — users, videos, views, comments and open reports — each with a ring and an arrow setting the last 30 days against the 30 before. Below them: activity (views, comments, likes) or community (new members, uploads, subscriptions) as smooth lines by month, week or day; the members active in the last 30 days on a gauge; profile statistics; new members per period; then money, the newest members and the most viewed videos. Point at a chart to see its numbers, or download any chart as a spreadsheet (CSV). It follows your light or dark mode.

29 Nov 2026
Admin

A new admin on phones

On phones and tablets the admin panel has a new look: a menu hangs from the top bar showing the page you are on. Tap it for every admin page, grouped, with counts of what is waiting, and Settings opening in place. Search finds any page or setting. Each page sits in a card, and on phones its tables turn into easy-to-read cards. It follows your light or dark mode.

29 Nov 2026
Admin

The admin panel becomes a desktop

On computers, the admin panel now works like a desktop: each admin page is an app with its own icon, opening in a window you can drag, resize, snap to half the screen, maximize or minimize to the taskbar, with several open side by side. The taskbar has a Start menu that searches every page, counts of the reports, messages and payments waiting, the state of video processing, quick settings and a notification centre. The wallpaper, light or dark, and accent colour are in Personalize.

29 Nov 2026
Watch page

Up next first on phones

On phones, a video's page now opens on Up next, and its tabs read Up next, Comments, About. A link to a comment, such as a reply notification, opens Comments.

29 Nov 2026
Watch page

Phone player: full width, the video's own shape, sound on

On phones, the video now runs edge to edge right under the top bar, in the shape it was uploaded in — 16:9, 4:3 or upright — instead of sitting in a bordered 16:9 frame; one too tall for the screen is fitted into it. It starts by itself, with sound, from where you left off, so the red Play button under the title is gone. Browsers allow sound only once you have touched the site: a video you open from another page of the site, or in the BreakTV apps, plays with sound straight away, while a link opened fresh starts muted and your first tap anywhere turns the sound on.

13 Nov 2026
Watch page

Edit or delete your video from its page

On a video's page, its uploader now sees Edit video, Analytics and Delete under the buttons. Delete asks first, then removes the video and opens Studio → Videos. The ⋯ menu (Watch later, Report) also opens properly now: the row of buttons used to cut it off.

13 Nov 2026
App

Pull down to reload

On touch screens, pulling a page down from the top reloads it — in the browser, the installed web app, the Android and iOS apps and the Telegram Mini App. A disc slides down with its arrow turning as you pull, and turns red once letting go will reload; if a new version of the app is waiting, the reload installs it too. It stays out of the way on the video player, the Shorts player, menus and pop-ups.

13 Nov 2026
Home

Whole 16:9 thumbnails on the home page

The home page now shows each video's thumbnail whole, in 16:9, instead of cropping it to a tall poster: in the featured carousel at the top, where the next videos peek from the sides, and in every row. On phones each row is a swipeable carousel with two and a half videos across — the cut-off third shows there is more — with the title, views and age under each picture, and every swipe stops at the start of a video. On computers the rows show four videos across, and three bigger ones in Must-Watch. Shorts stay vertical: on phones they are now a shelf of 9:16 thumbnails, three and a half across, instead of circles.

13 Nov 2026
Live

Live streams on Cloudflare Stream

Live streams can run on Cloudflare Stream: creators go live from OBS, vMix or Larix over RTMPS or SRT, with their channel's own server and stream key, which stay the same from one broadcast to the next. A browser camera broadcast is relayed to Cloudflare, and viewers watch from Cloudflare. When a stream ends, its recording is copied into the video library and deleted from Cloudflare. Switched on in Admin → Settings → Live streaming.

12 Nov 2026
Shorts

Shorts play full screen

The Shorts page now fills the screen like Reels: the site's bars give way to a back arrow, and the buttons sit on the picture. The whole video shows on a blurred copy of its cover, never cropped, and on computers each short is a 9:16 card on a night sky. The seek bar along the bottom can be dragged, and Space pauses or plays.

12 Nov 2026
Security

Paid and private videos in a private bucket

Videos with a price or set to private now play from a second R2 bucket with no public address: a link copied from the player stops working when its signature expires, and the files move by themselves when the price or privacy changes. Downloads are also saved under the title as written, Khmer titles included.

12 Nov 2026
CDN

Videos stream from Cloudflare's CDN

New uploads now go to a Cloudflare R2 bucket and play from cdn.breaktv.asia instead of the server's disk: no egress fees, no ceiling set by the server's disk, and the server no longer sends the video bytes itself. Existing videos were moved over.

12 Nov 2026
Import

YouTube imports work from the server again

YouTube asks servers in data centres to sign in, which stopped imports with “confirm you’re not a bot”. YouTube links now go through a residential proxy set in Admin → Settings → Features, with one sticky session per import and a fresh one when YouTube blocks it.

12 Nov 2026
Khmer

Khmer text in Noto Sans Khmer

Every screen, both themes and this page now set Khmer text in Noto Sans Khmer, loaded as one variable font instead of four weights of Kantumruy Pro.

12 Nov 2026
Docs

Platform documentation at /doc

This page: every module of the platform in one place — the video pipeline, money flows, admin suite, architecture and API — in English and Khmer, with screens of the current build.

11 Nov 2026
Upload

Uploads after psar.online: cover frames, soundtracks and operator imports

Publishing now has two phases: five cover frames are cut the moment the file is in, and Publish queues the heavy encode. Uploaders can add a soundtrack from the new music library or their own audio, under or instead of the original sound. Importing from links became an operator tool for staff and granted accounts, HLS segments are now 4 seconds, and the player caches segments and loads the next short ahead.

10 Nov 2026
Theme

A glassy coverflow of featured videos

The home page of the BreakTV theme now opens with a 3D coverflow of featured videos: the middle card plays, its neighbours turn away, and a glass dock shows the position with previous, play/pause and next. It moves by drag, swipe or arrow keys, advances every 8 seconds and pauses on hover — 16:9 cards on desktops, 2:3 posters on phones.

9 Nov 2026
Payments · Ads

Bakong KHQR top-ups and a real ad server

Ported from breaktv.asia: wallet top-ups by Bakong KHQR, credited once the Bakong API confirms the exact amount; Pro and memberships that can renew from the wallet; referral shares of a referred member's first purchases; and an earnings report. Ads now play in breaks, serve VAST 4.1 to other players, count through signed pixels and report to advertisers in their own portal.

9 Nov 2026
Brand

PlayTube is now BreakTV

The site name, browser title, Android and iOS app names, push notifications and the built-in theme now say BreakTV. Sites still on the old default name are renamed automatically; a name an admin chose is kept.

9 Nov 2026
PWA

Offline shell, update prompt and web push are back

The service worker now registers on every visit, which brings back the offline app shell, the “new version — reload” banner (now translated too) and web push notifications. The home page is fetched network-first, so it always carries the server's meta tags.

8 Nov 2026
Theme

A cinematic desktop layout

On tablets and desktops the built-in dark theme now has a pill menu and red-tabbed rows of posters — genres, top 10 per genre, trending, new releases, must-watch, movies, shows, shorts, channels and articles — above a six-column footer. Phones keep the poster-first, Netflix-style layout.

7 Nov 2026
Launch

Rebuilt on React and Node.js

The full feature set of the PlayTube 3.1.1 script, rebuilt from the ground up: React 19 and Vite in front, Node.js 22, Express 5 and SQLite behind, FFmpeg for video, and Capacitor apps for Android and iOS.

Product Tour

See it in action

Real screens of the current BreakTV build with breaktv.asia's own content — captured December 2026.

breaktv.asia/
BreakTV desktop home page: the side menu, and the featured coverflow with its controls
Desktop home — side menu and the featured coverflow
breaktv.asia/watch/CCbXUKLu5fPzk9G
Watch page: the player, the channel, subscribe, like, share, save and download buttons, comments and the next videos
Watch page — player, subscribe, share, save and download
Phone home: the featured coverflow, then the Shorts and Trending rows
🏠 Home — featured coverflow
Phone watch page: the player, then the Up next, Comments and About tabs
▶️ Watching on a phone
Search results with Videos, Channels, Playlists and Articles tabs
🔎 Search — videos, channels, playlists
Channel page with subscribe and message buttons and tabs
📺 Channel page
Categories: a tile for each category, then a row of videos for each
🗂️ Categories
Tile menu: Movies, Trending, Categories, My list, Language, Profile
🧭 Tile menu
Home page in Khmer
🇰🇭 Home in Khmer
Tile menu in Khmer
🇰🇭 Menu in Khmer
← scroll to see more →
Pipelines

From upload to screen, automatically

Videos, streams, live broadcasts, AI designs and each new version of the site have a pipeline of their own, run by the media worker, the Cloudflare edge or CI, so nobody waits on them.

Video

Upload to adaptive stream

Every upload and import goes through the same FFmpeg pipeline in a separate media worker, so the site never waits on an encode.

1

Upload

8 MB resumable chunks; FFprobe reads the real size and length, and portrait clips up to 60 s become shorts.

2

Cover frames

Five frames at 10/25/50/75/90% are cut the moment the file is in — the uploader picks the cover, or has AI design one.

3

Music Mix

Optional: a library track or the uploader's own audio, under or instead of the original sound, faded out at the end.

4

HLS Convert

Lowest rendition first so it plays fast, then the rest in one decode — H.264 + AAC, 4 s segments.

5

Store

Renditions go to Cloudflare R2: public videos to the main bucket, paid and private ones to a second bucket with no public address.

The bitrate ladder

Renditions are named by the short side, so a 1080×1920 short is “1080p”, and only rungs the source can fill are made. Frame rates above 30 fps are kept from 720p up.

On by default Opt-in · Admin → Settings → Video & FFmpeg
Delivery

Every segment checked at the edge

How a video reaches the player, and why a download tool gets nothing faster than watching.

1

Watch

The watch page gets a stream token with the video's details: Ed25519-signed, good for ten minutes, made out for the viewer's country.

2

Window

Before each stretch the player asks for a window token: twenty seconds of video, handed out at most 2.5× faster than it plays.

3

Edge check

The breaktv-edge Worker checks the token with the server's public key, the browser's Sec-Fetch headers and the player's X-Play proof.

4

From R2

Segments that pass come straight from the R2 bucket. What the Worker can't answer falls back to the server, which applies the same rules.

5

Play

hls.js picks the rendition, the service worker keeps segments for three days, and the player renews its token before it runs out.

Live

Camera to replay

Two engines, chosen in Admin → Settings → Live streaming: this server, or Cloudflare Stream for OBS.

1

Go live

From the browser's camera or screen; with Cloudflare Stream, also from OBS over RTMPS or SRT.

2

Ingest

MediaRecorder chunks (WebM, or MP4 on Safari) arrive over a WebSocket and are piped into ffmpeg.

3

Package

ffmpeg writes an EVENT HLS playlist; on Cloudflare Stream, Cloudflare packages it and a watcher flips the video live.

4

Watch

Viewers play it with hls.js, with live chat and the number watching.

5

Replay

When the stream ends the playlist closes and is a video at once; Cloudflare recordings are copied into the library.

AI designs

A frame becomes a cover

A job on the worker's AI lane, with Cloudflare Workers AI; ten designs per member a day by default.

1

Pick

The uploader picks one of the five frames, ticks “Design it with AI” and a style, or leaves the style to the model.

2

Brief

Gemma 4 looks at the frame and the title (often in Khmer) and writes, in English, what the cover should show.

3

Paint

FLUX.2 [klein] repaints the frame twice: a wide cover for phones and sharing, and a tall 5:7 poster for the lists.

4

Apply

Both go next to the video's other public pictures and replace its cover. No lettering is drawn: the site prints the title itself.

5

Switch

The frames stay, so the uploader can go back to one, or forward to the design again, at any time in Studio.

Ship

Commit to live site, hands off

Every change to the main branch goes out the same way, and is checked on the live site at the end.

1

Test

GitHub Actions runs the server's end-to-end tests and the web build for every pull request and push.

2

Promote

A push to main that passes moves the production branch to it.

3

Edge

CI deploys the breaktv-edge Worker with this build's static files, and the doc.breaktv.asia Worker.

4

Server

A systemd timer on the server sees production move within a minute and runs deploy.sh: build beside the live copy, back up, migrate, reload PM2.

5

Verify

CI waits until breaktv.asia loads this build's script from the Worker and the API answers, then checks the old addresses' redirects.

Import by Link (operator tool)

A link → yt-dlp → FFmpeg → HLS → a native video. For staff and the accounts an admin grants, on the web only — unless an admin opens it to every uploader.

Smart Playback

hls.js with adaptive bitrate; the service worker caches segments (cache first) and playlists (network first) without their stream tokens, and loads the next short ahead.

Two-Phase Publishing

Frames first, the heavy encode on Publish; videos over a minute go live at the lowest quality while the higher renditions are still encoding, with progress streamed over a WebSocket.

Soundtracks

A library track (Admin → Music library) or the uploader's own audio, from a chosen start, mixed in during the encode — cut or padded to length, faded out, and named on Shorts.

Previews & storyboards

A muted hover clip for every video card, and a sprite sheet with a WebVTT index that shows a thumbnail as you scrub the seek bar.

Watermark, trailers & downloads

An optional logo burned into every rendition, a 60-second trailer that paid videos show for free, and an MP4 of the top rendition for downloads.

The Watch Experience

A player built around HLS — adaptive quality, resume, subtitles and seek previews — the same on the web, in the installed app and inside Telegram.

Auto & manual quality Playback speed WebVTT subtitles Seek-bar thumbnails Resume where you left off Autoplay next Keyboard shortcuts Double-tap to seek Picture-in-picture In-video cards Pre-, mid- & post-roll ads Embeds & oEmbed
Resume anywhere

Your position is saved as you watch and picked up on any device; history can be paused.

Storyboard scrubbing

Hover or drag along the seek bar to see the frame you're about to jump to.

Subtitles in any language

Creators upload SRT or VTT tracks per language; SRT is converted to WebVTT on upload.

YouTube-style keys

Space or K to play, J / L for ±10 s, arrows for ±5 s and volume, F fullscreen, M mute, C captions.

Embeds everywhere

An /embed/:id player with oEmbed discovery, Open Graph video tags and Twitter player cards for rich link previews.

Creators & Viewers

Studio & Library

A back office for every creator and a personal library for every viewer — on the same account.

</> Creator Studio

Everything creators need to publish and grow.

  1. Overview · Videos · Comments · Ads, with a status badge on every upload
  2. Per-video analytics: views per day, watchers, average watch time, countries and platforms
  3. Privacy, scheduled publishing, an 18+ age limit and per-country blocking
  4. Sell and rent prices, unlocked for channel members, with a free trailer
  5. Cover frames, soundtracks, subtitles, in-video cards, series, seasons and episodes
  6. Switches for comments, downloads, embedding and ads on each video

</> Viewer Library

Everything viewers keep, in one place.

  1. Watch history (which can be paused), Watch later, Saved and Liked
  2. Playlists you can reorder, share and subscribe to
  3. Subscriptions with a per-channel notification bell
  4. Purchased and rented videos, with their expiry
  5. Full-text search with suggestions, filters and hashtags
  6. Direct messages, notifications and a blocked-users list

Wallet & Payouts

Two balances: a wallet to spend, and creator earnings to withdraw.

Top-ups

Bakong KHQR from any Cambodian bank app — credited once Bakong confirms the exact amount — or a bank receipt an admin approves, or Telegram Stars.

Spend

Pro plans and paid memberships — which can renew from the wallet — videos to buy or rent for two days, and ad campaigns.

Creator earnings

Sales, rentals and memberships pay the creator after a site commission (10% by default), plus a share of the ads on their videos; earnings can move into the wallet.

Withdrawals

PayPal, bank or ABA from $50; the amount is held at once and refunded if an admin rejects the request.

Points, Pro & Referrals

A rewards loop that brings viewers back, and plans that unlock more.

Earn points

Likes (5), comments (10), watching (2) and uploads (20), up to 1,000 a day — or 2,000 on Pro.

Points to cash

100 points = $1, converted straight into the wallet.

Pro plans

Packages with their own price and length: bigger uploads (8 GB instead of 2 GB), no ads, a verified badge and featured videos — renewed from the wallet when the admin allows it.

Referrals & invitations

A sign-up reward plus a share of a referred member's first Pro purchase, first paid membership and first video purchase or rental; invitation codes for invite-only launches.

Distribution

Telegram Bot & Mini App

Meet viewers where they already are — the whole site runs inside Telegram, and the bot speaks English and Khmer.

Runs inside Telegram

The full site as a Mini App: sign-in from initData, Telegram's back button and light or dark colours, haptics, and swipe-to-close turned off so feeds scroll cleanly.

Bot commands

/latest, /trending, /search, /link, /unlink and /notifications on|off — with the command menu in English and Khmer.

Inline search

Type @ and the bot's name with a few words in any chat to share matching videos.

Account linking

Link from the site with a one-time code, sign in on the website with Log In With Telegram (Telegram's own window), or create an account straight from the Mini App.

Channel auto-post

Every new public video is posted to your Telegram channel with its thumbnail and an Open button.

Stars & notifications

Wallet top-ups paid with Telegram Stars through native invoices, and notifications delivered as bot messages.

Video Ad Server

Ad breaks in the player, self-serve campaigns, VAST tags for outside players and a portal for advertisers — with a revenue share for creators.

Pre-roll · mid-roll · post-roll Ads in shorts Pre-roll before YouTube & Vimeo embeds VAST 4.1 tags out VAST wrappers in Signed tracking pixels Skip after 0–30 s Cost per view · per click Daily & total budgets Category & country targeting Banners: sidebar, home, below the player No ads on Pro
Metered billing

Views, clicks and completed plays count once per viewer, ad and day; views and clicks are charged to the advertiser's wallet as they happen.

Creators get paid

Monetized creators earn a share of every billed ad on their videos — 50% by default — and can move it into their wallet.

Advertiser portal

Advertiser accounts follow the ads assigned to them, with daily stats for any period and CSV export.

Safety rails

Every served ad carries a signed reference, so only ads this server served are counted and billed; campaigns need approval and stop when their budgets run out.

Control Center

The Admin Suite

30 apps in four folders: on a computer a desktop with windows and a taskbar, on a phone a menu of its own, with inbox counts on anything waiting for a decision. Moderators work the content, money and ad queues; admins also get the reports, payment gateways, advertisers, tools and every setting.

Content
DashboardLive stats & inbox
VideosApprove, feature, move to R2
UsersRoles, import grants, balances
CommentsModeration
ReportsCopyright & abuse
CategoriesVideo, movie, article
Music libraryTracks for uploads
PagesMarkdown pages
FAQHelp answers
AnnouncementsShown once to everyone
Contact messagesInbox
Money
Bank receiptsTop-up approvals
WithdrawalsPayout review
RequestsVerification & monetization
EarningsRevenue report
Online paymentsKHQR & re-checks
TransactionsFull ledger
Payment gatewaysBakong & connection check
Pro packagesPlans & perks
Ads
CampaignsApprove & manage
AdvertisersPortal accounts
Ad codesHTML ad slots
Ad settingsBreaks & pricing
Tools
Mass notificationEveryone at once
Bulk importPlaylists & channels
InvitationsInvite codes
ThemesPlaytag · BreakTV
AI thumbnailsWorkers AI & styles
Settings175 keys in 15 tabs
SystemJobs, yt-dlp, backups
Admin → Settings tabs
GeneralFeaturesLive streamingVideo & FFmpegAI thumbnailsStorage (R2) E-mailGoogle sign-inTelegramPush (FCM) PaymentsPayment gatewaysAdsPoints & referralsSecurity
Everywhere

Web, PWA & Reach

Built to reach every device, every inbox and every search engine.

Embeds & Sharing

Every public video has an embeddable player at /embed/:id, oEmbed for automatic embeds and Twitter player cards, so a shared link plays where it is posted.

Installable PWA

A Workbox service worker: offline app shell, cached thumbnails, fonts and video segments, an install offer on Android and iPhone, lock-screen controls and Share to BreakTV. A new version takes over with one reload.

Server-side SEO

Per-page titles and Open Graph from the server, JSON-LD VideoObject, sitemap.xml, RSS and a robots.txt the edge keeps a short copy of.

English & Khmer

Every screen in both languages, Khmer category names, and push and Telegram messages in each user's own language.

Light on mobile data

Adaptive HLS that starts at the lowest rendition, previews that load only when a thumbnail is hovered or held, pages loaded on demand, and a service worker that keeps the shell, fonts and segments.

Sign-in & Security

Password, Google and Telegram sign-in, two-factor by app or e-mail, per-device sessions and login throttling.

Notifications

In-app and live over WebSocket, web push through Firebase to browsers and the installed app (once set up in Admin), and Telegram messages — each user chooses per type and channel.

Messaging

Real-time direct messages with unread counts, and a setting for who may write to you: everyone, subscribers or no one.

Infrastructure

Where every request goes

Cloudflare in front of the site and under the videos, one server for everything that needs the database, and a handful of outside services. Each request is answered as close to the viewer as it can be.

At the edge: Cloudflare

Every request to breaktv.asia meets the breaktv-edge Worker first, on the same address as the server.

Static files at the edge

The build's hashed scripts and styles, icons and theme pictures are served by Cloudflare without reaching the server; scripts are cached for a year.

The stream shield

A video's segments come straight from R2 once the Worker has checked the token, the browser's headers and the player's proof. It holds only the server's public key, no secret.

Fails open

Past the free plan's 100,000 requests a day, or if the Worker fails, requests go straight to the server, which applies the same rules.

Old addresses and these docs

ott.breaktv.asia and www move every page to breaktv.asia with a 301. This page is a separate Worker with static files only, on doc.breaktv.asia.

On the server: one machine

One Linux server (AWS EC2) runs nginx and two PM2 processes, for everything that needs the database.

nginx

Takes TLS from Cloudflare, serves local media, hands out protected files once the API has checked them (X-Accel), and trusts the visitor's IP and country headers only from Cloudflare.

playtube-api

Express 5 on Node.js 22: the REST API, sign-in, the page shell with per-page meta tags, the WebSocket hub and the browser's live ingest — one process, so rooms and live streams stay together.

playtube-worker

The job queue in three lanes: heavy (transcodes, imports, live recordings, storage moves), light (notification fan-out, Telegram posts, moves between buckets) and AI (cover designs).

SQLite

One database file in WAL mode with FTS5 trigram search: 51 tables, and numbered migrations that run on every deploy.

Cloudflare R2

Two buckets, no egress fees. The main one serves thumbnails, previews and trailers on cdn.breaktv.asia and holds public streams; paid and private videos sit in a second bucket with no public address.

Workers AI

Cover designs over Cloudflare's REST API from the job queue: Gemma 4 writes the brief, FLUX.2 [klein] paints a 16:9 cover and a 5:7 poster. Its token can run models and nothing else.

Cloudflare Stream

The optional live engine: each channel gets an RTMPS/SRT input for OBS, viewers watch Cloudflare's HLS, and the worker copies the recording into the library.

Firebase Cloud Messaging

Web push to browsers and the installed app, in each user's language; tokens are registered again on every start. Off until a Firebase project is added in Admin → Settings → Push (FCM).

Telegram Bot API

A webhook bot, the Mini App, Log In With Telegram, channel posts and Stars top-ups.

Bakong KHQR

Top-up QR codes any Cambodian bank app can pay; the wallet is credited once the Bakong Open API confirms the exact amount.

E-mail over SMTP

Confirmations, password resets and two-step codes; written to the log until SMTP is set.

GitHub Actions

Tests and builds every change, promotes passing commits to production, deploys both Workers and checks the live site.

Security & limits

Protection at every layer, from the edge to the database.

Sessions

httpOnly cookies, X-Requested-With on every write, sessions per device that can be revoked, and two-step codes by app or e-mail.

Rate limits

900 API requests a minute per address; 30 sign-ins per 15 minutes; 10 sign-ups, password resets or e-mail resends an hour; 60 uploads or imports an hour. Five wrong passwords lock an account for 10 minutes.

At the edge

Dotfiles, internal paths and scanner probes get a 404 before they reach the server; bodies over 64 MB a 413; http goes to https.

Streams

Ed25519 tokens signed with a key the edge never sees, made out for one video, ten minutes and the viewer's country; 600 window tokens a minute at most.

Data & deploys

Data that stays small, plain and easy to back up, and deploys that viewers never notice.

One SQLite file

WAL mode for reads during writes, FTS5 trigram search that finds words inside Khmer text (which has no spaces), and numbered migrations.

Backups

A consistent copy before every deploy's migrations, the newest 14 kept; media lives in R2, receipts and ID documents in private storage.

Deploys without downtime

The new build is made beside the live one and swapped in; the last seven days of script chunks stay, so open tabs keep loading pages.

Careful restarts

The media worker restarts only when the server's code changed, so a deploy of the site alone never interrupts a transcode.

System Design

Architecture

One Express API and one SQLite database, a separate media worker for the heavy lifting, and a Cloudflare Worker in front.

① Clients
Web · React 19 + Vite PWA · Workbox Telegram Mini App Embeds · /embed/:id + oEmbed Other players · VAST 4.1 tags
② Edge — Cloudflare
DNS + TLS · proxied Worker breaktv-edge · static files + shield R2 · two buckets · cdn.breaktv.asia CF-IPCountry → geo-blocking Worker breaktv-doc · doc.breaktv.asia
③ Application — nginx & PM2 “playtube-api”
nginx · TLS origin + /media X-Accel protected files Express 5 REST API :4720 WebSocket hub · rooms + live ingest Page shell with per-route meta SQLite · WAL + FTS5 trigram Sessions · roles · rate limits Ad server · VAST 4.1
④ Media worker & integrations — PM2 “playtube-worker”
FFmpeg / FFprobe → HLS yt-dlp imports Three lanes · heavy · light · AI Workers AI · Gemma 4 + FLUX.2 Cloudflare Stream · live inputs Firebase Cloud Messaging Telegram Bot API SMTP e-mail Bakong API · KHQR
Developer

REST API surface

280+ endpoints under /api, guarded by session and role — a representative slice of each group.

Auth

POST/api/auth/register · /login · /2fa
POST/api/auth/telegram/miniapp · /oidc · /widget
POST/api/auth/google
GET/api/auth/me

Videos

GET/api/videos · /:id · /:id/related
POST/api/videos/:id/react · /view · /progress
POST/api/videos/:id/purchase
GET/api/videos/:id/storyboard.vtt

Upload & Import

POST/api/upload/init
PUT/api/upload/:id?offset=
POST/api/upload/:id/frames · /music
POST/api/upload/:id/complete
POST/api/import/preview · /playlist

Streaming

GET/api/videos/:id/stream-token?at=
GET/api/s/:video.:encode/:token/:file
GET/api/s/key (the shield's public key)
WS/ws/live/:id (browser ingest)

Channels & Library

GET/api/channels/:username
POST/api/channels/:username/subscribe · /membership
*/api/playlists/*
GET/api/library/history · /watch-later

Social

*/api/comments/*
*/api/posts/* · /api/articles/*
POST/api/messages/:userId
GET/api/notifications · /unread

Wallet

GET/api/wallet · /transactions
POST/api/wallet/khqr
GET/api/wallet/khqr/:id
POST/api/wallet/withdraw · /transfer · /auto-renew

Ads

GET/api/ads/player?slot= · /banner
GET/api/ads/vast.xml · /:id/vast.xml
GET/api/ads/px/:token/:event
GET/api/advertiser (portal)

Platform & Admin

GET/api/config · /home · /search · /music
POST/api/live · /:id/end · /:id/reset-key
GET/api/live/:id/encoder · /status · /chat
GET/sitemap.xml · /rss.xml · /api/oembed
POST/api/telegram/webhook/:secret
*/api/admin/* (staff only)

Everything is JSON. Browsers use an httpOnly session cookie (plus X-Requested-With on writes); the Telegram Mini App and native apps send a bearer token.

Under the Hood

Technology

React 19 · Vite Tailwind CSS 4 · daisyUI 5 TanStack Query Zustand hls.js Node.js 22 · Express 5 SQLite · better-sqlite3 FTS5 trigram search WebSocket (ws) FFmpeg · FFprobe yt-dlp Cloudflare R2 · AWS S3 SDK Workbox service worker Firebase Cloud Messaging Telegram Bot API · Mini Apps Bakong KHQR Cloudflare Workers · static assets Workers AI · Gemma 4 · FLUX.2 Cloudflare Stream Ed25519 stream tokens nginx · PM2 · systemd GitHub Actions Lucide icons
Reference

Per-module deep dives

Expand any module for how it actually works under the hood.

Video Processing & Convert Pipeline
  • Upload: POST /api/upload/init returns an upload id and an 8 MB chunk size; the client PUTs each chunk at ?offset= (nginx streams it to Node without buffering) and, after a dropped connection, resumes from the server's received count.
  • Phase one — cover frames: as soon as the bytes are in, /frames cuts five frames at 10, 25, 50, 75 and 90 % for the uploader to pick a cover. FFprobe gives the duration, frame rate and display-correct size (sample aspect ratio and rotation applied), and a portrait video no longer than 60 s is flagged as a short.
  • Phase two — Publish: /complete queues the heavy work in the media worker, which publishes the frames already cut. Videos over a minute get two passes: the lowest rendition alone, so the video is public and playable at once, then every remaining rendition from a single decode. H.264 (x264 preset from settings, veryfast by default) and AAC in 4-second MPEG-TS segments, with a master playlist that carries BANDWIDTH, RESOLUTION, CODECS and FRAME-RATE.
  • Soundtrack: a track from the music library, or the uploader's own audio file when the admin allows it, from a chosen start point — replacing the video's sound or playing under it ("Keep the original sound"). It is mixed in during the HLS encode, cut or padded to the video's length and faded out, and its name shows on Shorts.
  • Extras: an optional watermark overlay; for videos over 90 s, a 60-second trailer remuxed from the low rendition without re-encoding; an MP4 remux of the top rendition for downloads; a muted 24 fps hover preview; a storyboard sprite whose WebVTT index the API generates on the fly.
  • Publish: once the first pass is ready the creator is notified, subscribers with the bell on get a push and Telegram message, and a Telegram channel post is queued. A failed job keeps its source for a retry from Admin → System.
lib/ffmpeg.jslib/uploads.jslib/music.jsservices/media.jsroutes/upload.jsFFmpegHLS
Live Streaming
  • Ingest: the broadcaster's browser records the camera or a shared screen with MediaRecorder — WebM, or fragmented MP4 on Safari — and streams the chunks over a WebSocket to /ws/live/:id.
  • Packaging, on this server: the API pipes them into FFmpeg, which writes an EVENT HLS playlist in 2-second segments; viewers play it with hls.js while it grows.
  • Or on Cloudflare Stream (Admin → Settings → Live streaming): each channel gets a live input through the Stream API, kept between broadcasts, so OBS, vMix or Larix keep one RTMPS or SRT server and key; the owner can reset the key. A browser broadcast is encoded to H.264/AAC at a constant 2.5 Mbps with 4-second keyframes and relayed to the input over RTMPS. A watcher asks each input's lifecycle endpoint (the API's list of the input's videos as fallback) and flips the stream live, and back after 75 seconds without a signal. Viewers play Cloudflare's HLS. Ending switches the input off, so a stray reconnect can't record unseen.
  • Resilience: a network blip doesn't end the show — a reconnecting broadcaster takes over the same session and the playlist continues. Streams left open by an API restart are closed out on boot.
  • Interaction: live chat and viewer counts travel over per-video WebSocket rooms, and subscribers get a "live now" notification.
  • After the stream: the playlist gets ENDLIST and is a VOD at once. With saving switched on, the worker builds the normal ABR ladder from the recording and switches playback over. On Cloudflare, the live_recording job waits until Stream has the recording ready, copies it here without re-encoding (several pieces joined if the broadcast dropped), transcodes it like an upload and deletes it from Cloudflare, so Stream storage stays near empty; until then it plays from Cloudflare.
services/live.jslib/cfstream.jspages/GoLive.jsxMediaRecorderEVENT playlistStream live inputs
Access Control & Protected Streams
  • One rule set decides every play request, in order: processing, pending approval, private, scheduled, login required, geo-blocked (from Cloudflare's CF-IPCountry), age-restricted (18+, from the birthday on the account) and paid (a purchase, an active rental or a channel membership).
  • Pictures and previews come straight from the CDN (cdn.breaktv.asia on Cloudflare R2, or /media on a local-disk install): thumbnails, hover previews and trailers stay public. A video's stream never has a public address.
  • The stream shield (on by default): every stream, public ones included, plays from /api/s/<video>.<encode>/<token>/<file>. The token is signed with Ed25519, names one video and encode, lasts ten minutes and is made out for the viewer's country; the player renews it before it runs out.
  • Each request must look like the player: a browser's Sec-Fetch-* headers from a page of the site, no extension's origin, no downloader's name, and the player's proof for that very file (X-Play), so a request copied into a tool opens that one file and no other.
  • Windows, not films: a segment opens only under a token whose window holds it, twenty seconds of video from GET /api/videos/:id/stream-token?at=. Windows are paid from an account per network address and video: a minute and a half at once, refilled at 2.5 times the playing speed (Settings → Security). The iPhone's own player gets a plain token for the length of the video, and the server answers its requests at the same pace.
  • At the edge: the breaktv-edge Worker checks all this with the server's public key (/api/s/key) and serves the files straight from R2. The server answers what the Worker can't — local files, an iPhone's player, a request past the Worker's daily limit — with the same rules, sending each segment as an R2 link signed for that one request, or from local disk through nginx's internal /_protected/ location.
  • Two buckets: paid and private videos keep their stream in a second bucket with no public address, and a change of price or privacy moves the files over inside R2. The site's own Download button answers only a click on the video's page. What no rule stops is a program recording the player at watching speed: only DRM closes that.
  • Paid videos can still show their 60-second trailer, which is stored apart from the protected stream so it never reveals where the stream lives.
lib/access.jslib/streamShield.jslib/streamPace.jsedge/src/shield.jsEd25519X-Accel-Redirect
Import by Link
  • YouTube from a data centre: YouTube asks servers to sign in, so YouTube links go through the residential proxy set in Settings → Features. Each run gets its own sticky session, so the page and the video bytes come from one IP (YouTube ties its media URLs to it), and a blocked session is retried on up to two more. Other sites go direct, sparing the proxy allowance; errors never show the proxy password.
  • Who: an operator tool — admins, moderators and the accounts an admin gives "Can import from links" in Admin → Users, on the website. Settings → Features → "Who can import videos from links" can open it to everyone who may upload.
  • Preview: yt-dlp metadata is fetched and cached briefly, so submitting doesn't fetch it twice; the duplicate warning also counts public copies of the same source.
  • Embed or download (Settings → Features): embeds use each provider's own player — YouTube (privacy-enhanced), Vimeo, Dailymotion, Twitch videos and clips, Facebook, TikTok, Instagram and OK.ru. Downloads take the best MP4-compatible stream up to 1080p and run it through the same transcode pipeline, where vertical clips become shorts.
  • Bulk import for admins lists a whole playlist or channel; the chosen entries are submitted one by one. yt-dlp is installed into server/bin/ and updated in place from Admin → System.
lib/ytdlp.jsroutes/import.jscan_importyt-dlp
Search & Discovery
  • SQLite FTS5 with the trigram tokenizer over title, description and tags, ranked by bm25 with the title weighted highest. Trigrams match any part of a word, which suits Khmer text written without spaces between words.
  • Queries shorter than three characters fall back to LIKE; search suggestions come from the same index.
  • Result tabs for videos, channels, playlists and articles, with filters; hashtag pages and trending hashtags; categories with Khmer names; trending, latest and most-viewed lists; popular channels; stock videos; and a coverflow of featured videos on the home page.
videos_ftsbm25routes/search.js
Player
  • hls.js with adaptive bitrate, and the browser's own HLS on iOS Safari; menus for quality, speed and subtitles.
  • Resume from the saved position (when you stopped more than 10 s in and not in the last 15 s); progress is saved while you watch.
  • Keyboard: Space/K, J/L, the arrow keys, F, M and C. Touch: tap for the controls, double-tap either side to seek 10 s.
  • Storyboard thumbnails over the progress bar, picture-in-picture, autoplay next, and in-video cards with start and end times.
  • Ad breaks: before the video, half-way through, at the end, and in shorts after a few seconds; embedded YouTube and Vimeo videos get the pre-roll before the embed loads. VAST wrappers are followed and their tracking pixels fired.
  • Caching: the service worker keeps segments (cache first) and playlists (network first) under keys without stream tokens or S3 signatures, loads the next short ahead, and is cleared on sign-out.
components/player/Player.jsxsw.jshls.js
Wallet, Payments & Payouts
  • Two ledgers per user: the wallet (money to spend) and the balance (creator earnings that can be withdrawn or moved into the wallet). Every credit and debit is written in one database transaction together with its ledger row.
  • Bakong KHQR: the site shows a dynamic KHQR for its Bakong account, laid out byte for byte like the National Bank's KHQR SDK, and the payer scans it with any Cambodian bank app. The wallet is credited only when the Bakong API confirms a payment to that account for the exact amount and currency — while the page asks, and in a background check that keeps going if the payer closes it.
  • Other top-ups: bank-transfer receipts approved by an admin, and Telegram Stars invoices. No card processor is wired in.
  • Spending: Pro packages, buying or renting videos (rentals last 2 days by default), paid channel memberships and ad campaigns. Sales, rentals and memberships are split between the creator and the site commission. Pro and memberships renew from the wallet once the admin turns renewal on, and each member can switch it off; a renewal can never be charged twice.
  • Withdrawals: PayPal, bank or ABA (configurable), $50 minimum, held immediately and refunded on rejection.
  • Rewards: points per action with daily caps, converted at 100 to $1; referrals pay a sign-up reward and a share of a referred member's first Pro purchase, first membership and first video purchase or rental.
  • Admin: an earnings report, the list of online payments with a manual re-check, and a Payment gateways tab with a connection check.
lib/bakong.jslib/khqr.jslib/wallet.jslib/referrals.jsroutes/wallet.js
Advertising
  • Breaks: player ads play before the video, half-way (at 50 % by default, optionally only in longer videos), at the end, and in shorts after 10 seconds; embedded YouTube and Vimeo videos get the pre-roll before the embed loads.
  • Formats: uploaded video or image creatives (video normalized to at most 720p), creatives added by link, and VAST campaigns, whose wrappers the player follows; banners in three placements — sidebar, home and below the player.
  • Ad server: VAST 4.1 tags (/api/ads/vast.xml) serve the site's ads to other players. Every served ad carries a signed reference, and impressions, clicks and completed plays come back through signed pixels, counted once per viewer, ad and day.
  • Money: CPV and CPC are charged to the advertiser's wallet, and the video's monetized creator earns the publisher share (50 % by default). Campaigns serve only while their daily and total budgets last, matched by category and country.
  • Advertisers: accounts that follow the ads assigned to them in a portal with daily stats for any period and CSV export; admins choose who may create self-serve ads.
  • Pro: ad-free by default; the admin can keep direct-sold player ads for Pro members, but never banners.
lib/adserver.jsroutes/ads.jsroutes/advertiser.jsVAST 4.1CPV · CPC
Telegram Bot & Mini App
  • Setup: one button in Admin → Settings → Telegram registers the webhook (with a secret token), the English and Khmer command menus and the Mini App menu button; long polling is available for development.
  • Mini App: ready() and expand(), swipe-to-close disabled, Telegram's back button synced to the route, colour scheme and header colours, start_param deep links, haptics and Stars invoices.
  • Sign-in: Mini App initData, or on the website Log In With Telegram (Telegram's own OpenID Connect window, or the older login widget), signs into the bound account; a new Telegram user creates an account or binds an existing one with a password; site users link with a one-time code.
  • Delivery: notification fan-out is throttled to Telegram's limit of about 30 messages a second, and new public videos post to a channel with an Open button.
services/telegramBot.jslib/telegram.jsBot APIStars
Notifications & Real-time
  • One WebSocket hub: per-user rooms (notifications, messages, transcode progress) and per-video rooms (live chat, viewer counts).
  • notify() stores the in-app notification, emits it live, then pushes through FCM and Telegram according to each user's preferences; liking, unliking and liking again doesn't spam anyone.
  • Fan-out: new uploads and go-live events reach subscribers with the bell on, in batches, with one FCM multicast per batch and language.
  • The media worker reaches browsers through a loopback-only event bridge into the API's hub.
services/hub.jslib/notify.jslib/fcm.js/ws
SEO & Sharing
  • The API renders the app shell per route with title, description, canonical, Open Graph and Twitter tags — og:video and player cards on watch pages — and a JSON-LD VideoObject with the view count.
  • An oEmbed endpoint with a discovery link, and an embeddable player at /embed/:id, the only page any site may frame.
  • sitemap.xml, rss.xml, a robots.txt that keeps /api, /admin, /studio and /settings out of search engines, and a web-app manifest built from the admin settings.
routes/seo.jsVideoObjectoEmbed
Security & Accounts
  • Sessions: httpOnly cookies for browsers and bearer tokens for the Telegram Mini App and native apps; cookie-authenticated writes must carry X-Requested-With, which a cross-site form can't send. Sessions are listed per device and can be revoked.
  • Ways in: a password, Google (the server checks Google's signed token itself) or Log In With Telegram. Each asks for the two-step code when the account has one: an authenticator app (TOTP) or an e-mailed code. One-time tokens are stored only as hashes.
  • Limits: login throttling (5 attempts, then a 10-minute lock, by default), an API rate limit of 900 requests a minute per address, and a maintenance mode that keeps staff working.
  • Trust: verification badges and monetization by request with an ID photo; optional e-mail verification, invite-only registration and required sign-in. Creative links are checked against private addresses on every connection and redirect.
  • nginx accepts CF-Connecting-IP and CF-IPCountry only from Cloudflare and loopback, so visitors can't choose their own address or country.
lib/auth.jsroutes/auth.jsTOTPhelmet
Themes & Settings
  • Two themes, switched for every visitor: Playtag (an icon rail with sliding labels, a featured slider and a violet accent) and BreakTV (always dark: the StreamVibe layout on tablets, re-framed on computers with a side menu, framed poster cards and a pill navbar; a Netflix-style layout on phones; and a glassy coverflow of featured videos at the top of the home page).
  • An accent colour can override the theme's own; the site name, logo, favicon, default language and light or dark default are settings too.
  • 175 settings in 15 tabs live in the database; secrets never reach the browser and are masked in the admin, and there are built-in tests for SMTP, R2, Cloudflare Stream, Workers AI, push, the Telegram bot and the Bakong connection.
lib/settings.jsthemes/vibethemes/flixthemes/playtag
Deploy & Operations
  • Processes: nginx in front; PM2 runs playtube-api (one instance, because rooms and live streams live in this process) and playtube-worker, whose job queue runs in three lanes: heavy (transcodes, imports, live recordings, storage moves) limited by WORKER_CONCURRENCY, light (fan-out, Telegram posts, moves between buckets, mass notifications) and AI (thumbnail designs, which mostly wait on Workers AI). The technical names kept their playtube prefix through the BreakTV rename.
  • deploy.sh installs dependencies, builds the web app beside the live copy and swaps it in (keeping a week of old chunks for open tabs), backs up and migrates the database, reloads PM2 and health-checks the API.
  • Schedules in the worker: open KHQR payments checked every 15 seconds, scheduled videos announced every minute, memberships renewed or expired every 10 minutes, and temporary files cleaned every hour; a run still going is skipped, never doubled.
  • Backups: npm run backup keeps the 14 newest consistent copies of the live database; admins can also download one from Admin → System.
  • Shipping: GitHub Actions tests every change and moves the production branch to each passing commit of main; a systemd timer on the server deploys it within a minute, and the worker reloads only when the server's code changed, so a transcode is not cut short by a deploy of the site alone. CI then deploys the breaktv-edge and breaktv-doc Workers and checks that breaktv.asia serves the new build.
ecosystem.config.cjsdeploy/deploy.shdeploy/auto-deploy.sh.github/workflows/ci.ymlservices/cron.jsPM2nginx