How pea1bee/hotstar-ipl-ad-mute works
Project type and purpose
• This is a browser extension (Chrome & Firefox variants) whose sole job is to intercept Hotstar ad-tracking requests in a live stream and mute the tab for the ad’s duration.
• It runs entirely in the client’s browser, requires minimal permissions, and has no external backend of its own.
File structure
• Top level:
– chrome/
• manifest.json (extension config & permissions)
• background.js (service worker that listens to webRequest, controls tab audio)
– firefox/
• manifest.json (Firefox-specific config)
• background.js (same logic, Firefox API calls)
• No content scripts or UI pages—purely a background/service worker that uses browser.webRequest and browser.tabs APIs.
README for extra details
• The extension:
– Hooks into Hotstar’s tracking-pixel URL (https://bifrost-api.hotstar.com/v1/events/track/ct_impression)
– Extracts adName query parameter
– Estimates mute duration from identifier
– Mutes/unmutes the streaming tab via browser.tabs.update
• Customization points:
– A toggle (MUTE_ALL_ADS)
– A list of targetAdIds in background.js
a. Main components
1. User’s Browser (Chrome or Firefox)
2. Browser Extension
– Manifest (declares permissions: webRequest, tabs, host permissions for hotstar.com)
– Background Script (service worker)
3. Hotstar Streaming Website (web page with video player)
4. Hotstar Ad-Tracking API (pixel requests)
b. Relationships & Interactions
– User interacts with Hotstar live-stream page → video player runs in the page context
– Video player triggers ad-tracking pixel calls to Hotstar Ad-Tracking API
– Extension’s background.js listens (via webRequest.onBeforeRequest) for matching URLs
– On match: background.js parses adName, computes duration, calls browser.tabs.update(tabId, { muted: true })
– After estimated duration: background.js calls browser.tabs.update(tabId, { muted: false })
c. Architectural patterns / principles
– Event-driven: uses browser.webRequest events
– Single-process/service worker: no UI or content scripts
– Separation of concerns:
• Manifest only for permissions/config
• Background script contains all logic
d. Key technologies / libraries
– WebExtension APIs (chrome.* or browser.*)
– JavaScript (ES6+)
– Browser webRequest & tabs modules
Don’t over-complicate—capture exactly
– The extension’s two variants (Chrome, Firefox) share the same design—just note the separate manifest files.
– No backend servers of our own—only Hotstar’s endpoints.
– Core flow: detect request → mute → wait → unmute.