How aditauqir/fyp works
Purpose and deployment targets
FYouTube Premium is a browser-extension project that uses desktop YouTube as its backend while reshaping it for iPhone/Orion into a mobile-oriented, Premium-like experience: inline playback, background audio, ad blocking, simplified navigation, and responsive feed/search layouts. It has parallel Chrome/Manifest V3 and Firefox-compatible packages, with Orion consuming generated ZIP/XPI artifacts.
Paths: chrome-extension/manifest.json, firefox-extension/manifest.json, rebuild-extension.sh
Runtime entry points
Each extension package has three browser execution contexts:
• Content script runs on YouTube pages, injects/coordinates page-facing behavior, and applies UI transformations.
• Page script executes in the page context for direct interaction with YouTube’s player/application environment.
• Background script owns extension-level state, scheduled release checks, toolbar badge updates, and message handling.
• Popup provides changelog, navigation to YouTube, and manual update checking.
Paths: chrome-extension/content.js, chrome-extension/page.js, chrome-extension/background.js
YouTube transformation pipeline
The content/page layer selects the desktop YouTube experience and continuously adapts its dynamic SPA DOM into a phone-friendly interface. Major transformations include inline full-width player layout and controls, one-column watch/feed/playlist layouts, mobile search, hamburger-centered navigation, and comments/action-card handling. Because YouTube rerenders navigation and player surfaces, this layer must observe and reapply changes across route/state changes.
Paths: chrome-extension/content.js, chrome-extension/page.js, firefox-extension/content.template.js
Playback, media-session, and captions boundary
Page-context code manages browser-visible playback behavior that content scripts cannot reliably control alone: player state, inline controls, background/screen-off playback, and Media Session ownership for lock-screen controls. Caption handling constrains active tracks to one preferred track, deduplicates subtitle UI, and preserves user language selection behavior.
Paths: chrome-extension/page.js, chrome-extension/content.js, firefox-extension/page.js
Ad-blocking and YouTube network/player integration
The extension incorporates YouTube-specific ad blocking adapted from Universal Ad Blocker Pro. This is a high-risk compatibility boundary: it interacts with YouTube player, network, and overlay behavior rather than using YouTube APIs, and must coexist with YouTube’s evolving client-side application and playback lifecycle.
Paths: chrome-extension/page.js, firefox-extension/page.js
Extension UI and GitHub update flow
The popup queries the background runtime for version/update state and exposes user actions. The background periodically contacts GitHub Releases, compares the installed manifest version against the latest release, and sets an UP badge when an update is available. Updates remain manual because Orion does not replace sideloaded extensions automatically.
Paths: chrome-extension/popup.js, chrome-extension/background.js, chrome-extension/popup.html
Cross-browser packaging and release boundary
Chrome and Firefox source trees are maintained separately, likely due to manifest/runtime compatibility and Orion fallback packaging requirements. The build script validates generated JavaScript and emits the recommended Orion release ZIP plus Chrome ZIP, Firefox ZIP, Orion ZIP, and XPI artifacts. Release distribution is externalized to GitHub Releases.
Paths: chrome-extension/, firefox-extension/, rebuild-extension.sh
Main entry points: page.js Page script · background.js Background script · manifest.json MV3 manifest · content.js Content script
Components 17
Chrome / MV3 package
- MV3 manifest · Declares Chrome extension contexts and permissions.
chrome-extension/manifest.json - Content script · Adapts YouTube SPA surfaces and coordinates page-facing behavior.
chrome-extension/content.js - Page script · Controls YouTube player, network hooks, and page-owned browser APIs.
chrome-extension/page.js - Mobile UI transforms · Reapplies responsive player, feed, search, navigation, comments, and action layouts.
chrome-extension/content.js - Playback and captions · Owns inline/background playback, Media Session, and preferred caption-track behavior.
chrome-extension/page.js - YouTube ad blocking · Intercepts YouTube player, network, and overlay ad behavior.
chrome-extension/page.js - Background script · Handles messages, scheduled release checks, and update badge state.
chrome-extension/background.js - Popup UI · Shows changelog, YouTube navigation, and manual update actions.
chrome-extension/popup.html - Popup controller
chrome-extension/popup.js
Firefox-compatible package
- Firefox manifest
firefox-extension/manifest.json - Firefox content template · Firefox-compatible variant of the YouTube transformation layer.
firefox-extension/content.template.js - Firefox page script · Firefox-compatible playback and ad-block integration.
firefox-extension/page.js
Build and distribution
- Rebuild script · Validates generated JavaScript and builds browser release artifacts.
rebuild-extension.sh - Extension artifacts · Produces recommended Orion ZIP plus Chrome, Firefox, Orion ZIP, and XPI packages.
- GitHub Releases · Hosts published packages and latest-version metadata.
Other components
- YouTube desktop app · Dynamic SPA and playback backend reshaped for mobile use.
- Orion browser · Uses sideloaded artifacts and requires manual updates.
Connections 23
- MV3 manifest → Content script: loads
- MV3 manifest → Page script: injects
- MV3 manifest → Background script: starts
- MV3 manifest → Popup UI: declares
- Content script → Mobile UI transforms: applies
- Content script → Page script: coordinates with
- Content script → YouTube desktop app: observes SPA DOM
- Page script → Playback and captions: manages
- Page script → YouTube ad blocking: integrates
- Page script → YouTube desktop app: controls player/app
- Mobile UI transforms → YouTube desktop app: reshapes UI
- Popup UI → Popup controller: runs
- Popup controller → Background script: queries and requests checks
- Background script → GitHub Releases: checks latest release
- Background script → Popup controller: returns update state
- Firefox manifest → Firefox content template: loads
- Firefox manifest → Firefox page script: injects
- Firefox content template → YouTube desktop app: adapts DOM
- Firefox page script → YouTube desktop app: controls player/app
- Rebuild script → Extension artifacts: emits
- Extension artifacts → GitHub Releases: published to
- Extension artifacts → Orion browser: sideloaded into
- GitHub Releases → Background script: release metadata