One platform to stream, create & earn
BreakTV runs ott.breaktv.asia: uploads transcoded to an adaptive HLS ladder with cover frames and soundtracks, 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 — on the web, as an installable app, on Android and iOS, in English and Khmer.
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.
Recent Updates
The latest work shipping to ott.breaktv.asia — newest first.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
See it in action
Real screens of the current BreakTV build with ott.breaktv.asia's own content — captured November 2026.








From upload to adaptive stream, automatically
Every upload and import goes through the same FFmpeg pipeline in a separate media worker, so the site never waits on an encode.
Upload
8 MB resumable chunks; FFprobe reads the real size and length, and portrait clips up to 60 s become shorts.
Thumbnails
Five frames at 10/25/50/75/90% are cut the moment the file is in — the uploader picks the cover.
Music Mix
Optional: a library track or the uploader's own audio, under or instead of the original sound, faded out at the end.
HLS Convert
Lowest rendition first so it plays fast, then the rest in one decode — H.264 + AAC, 4 s segments.
CDN Deliver
Pushed to Cloudflare R2 · streamed via cdn.breaktv.asia; paid and private videos play from a private bucket through signed links that expire.
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.
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 apps and inside Telegram.
Your position is saved as you watch and picked up on any device; history can be paused.
Hover or drag along the seek bar to see the frame you're about to jump to.
Creators upload SRT or VTT tracks per language; SRT is converted to WebVTT on upload.
Space or K to play, J / L for ±10 s, arrows for ±5 s and volume, F fullscreen, M mute, C captions.
An /embed/:id player with oEmbed discovery, Open Graph video tags and Twitter player cards for rich link previews.
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.
- Overview · Videos · Comments · Ads, with a status badge on every upload
- Per-video analytics: views per day, watchers, average watch time, countries and platforms
- Privacy, scheduled publishing, an 18+ age limit and per-country blocking
- Sell and rent prices, unlocked for channel members, with a free trailer
- Cover frames, soundtracks, subtitles, in-video cards, series, seasons and episodes
- Switches for comments, downloads, embedding and ads on each video
</> Viewer Library
Everything viewers keep, in one place.
- Watch history (which can be paused), Watch later, Saved and Liked
- Playlists you can reorder, share and subscribe to
- Subscriptions with a per-channel notification bell
- Purchased and rented videos, with their expiry
- Full-text search with suggestions, filters and hashtags
- Direct messages, notifications and a blocked-users list
Wallet & Payouts
Two balances: a wallet to spend, and creator earnings to withdraw.
Bakong KHQR from any Cambodian bank app — credited once Bakong confirms the exact amount — or a bank receipt an admin approves, or Telegram Stars.
Pro plans and paid memberships — which can renew from the wallet — videos to buy or rent for two days, and ad campaigns.
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.
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.
Likes (5), comments (10), watching (2) and uploads (20), up to 1,000 a day — or 2,000 on Pro.
100 points = $1, converted straight into the wallet.
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.
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.
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 with the Telegram login widget, 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.
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.
Monetized creators earn a share of every billed ad on their videos — 50% by default — and can move it into their wallet.
Advertiser accounts follow the ads assigned to them, with daily stats for any period and CSV export.
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.
The Admin Suite
29 menu entries in four groups, 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.
Platform & Infrastructure
Built to reach every device, every inbox and every search engine.
Native Apps
Android and iOS through Capacitor 8, with push notifications, the camera for going live, and App Links that open shared videos in the app.
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, Share to BreakTV and an update banner.
Server-side SEO
Per-page titles and Open Graph from the server, JSON-LD VideoObject, oEmbed, Twitter player cards, sitemap.xml and RSS.
English & Khmer
Every screen in both languages, Khmer category names, and push and Telegram messages in each user's own language.
Cloudflare R2 + CDN
Videos and images live in Cloudflare R2 and stream from cdn.breaktv.asia, with no egress fees. Paid and private videos sit in a second bucket with no public address; worker jobs move videos between the two, and older ones over from the local disk.
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, push through Firebase on the web, Android and iOS, 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.
Architecture
One Express API and one SQLite database, a separate media worker for the heavy lifting, and nginx and Cloudflare at the edge.
REST API surface
270+ endpoints under /api, guarded by session and role — a representative slice of each group.
Auth
Videos
Upload & Import
Streaming
Channels & Library
Social
Wallet
Ads
Platform & Admin
Everything is JSON. Browsers use an httpOnly session cookie (plus X-Requested-With on writes); the apps and the Telegram Mini App send a bearer token.
Technology
Per-module deep dives
Expand any module for how it actually works under the hood.
Video Processing & Convert Pipeline
- Upload:
POST /api/upload/initreturns 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'sreceivedcount. - Phase one — cover frames: as soon as the bytes are in,
/framescuts 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:
/completequeues 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,veryfastby default) and AAC in 4-second MPEG-TS segments, with a master playlist that carriesBANDWIDTH,RESOLUTION,CODECSandFRAME-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.
Live Streaming
- Ingest: the broadcaster's browser or app 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
lifecycleendpoint (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
ENDLISTand 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, thelive_recordingjob 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.
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). - Public videos stream straight from the CDN (
cdn.breaktv.asiaon Cloudflare R2, or/mediaon a local-disk install), cached forever under unguessable prefixes. - Protected videos play through
/api/streamwith a short-lived HMAC stream token (6 hours) in the URL, because native HLS on iOS can't add headers. R2 segments become presigned GETs, so the bytes never touch the server. Paid and private videos keep their stream in a second bucket with no public address, so a link copied from the player dies with its signature; a change of price or privacy moves the files over inside R2. Local segments go out through nginx's internal/_protected/location viaX-Accel-Redirect. - 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.
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, and never in the mobile apps. 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.
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.
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.
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.
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.
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()andexpand(), swipe-to-close disabled, Telegram's back button synced to the route, colour scheme and header colours,start_paramdeep links, haptics and Stars invoices. - Sign-in: Mini App
initDataor the 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.
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.
SEO & Sharing
- The API renders the app shell per route with title, description, canonical, Open Graph and Twitter tags —
og:videoand player cards on watch pages — and a JSON-LDVideoObjectwith 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, arobots.txtthat keeps/api,/admin,/studioand/settingsout of search engines, and a web-app manifest built from the admin settings.
Security & Accounts
- Sessions: httpOnly cookies for browsers and bearer tokens for the apps and Telegram; 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. - Two-factor with 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-IPandCF-IPCountryonly from Cloudflare and loopback, so visitors can't choose their own address or country.
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 and desktops, 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.
- 165 settings in 14 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, push, the Telegram bot and the Bakong connection.
Deploy & Operations
- Processes: nginx in front; PM2 runs
playtube-api(one instance, because rooms and live streams live in this process) andplaytube-worker, whose CPU lane (transcodes, imports) is limited byWORKER_CONCURRENCYwhile an I/O lane (fan-out, housekeeping) runs beside it. The technical names kept theirplaytubeprefix 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 backupkeeps the 14 newest consistent copies of the live database; admins can also download one from Admin → System.