π Athan Auto Pause
A production-ready Chrome Extension (Manifest V3) that automatically pauses all audio and video across your browser tabs at Islamic prayer times, based on your location.
β¨ Features
- Automatic Media Pausing: Pauses all
<video> and <audio> elements across all tabs when prayer time arrives
- Offline Prayer Time Calculation: Uses established astronomical algorithms (PrayTimes.org style) - no internet required
- Multiple Calculation Methods: Muslim World League, ISNA, Egyptian, Umm al-Qura (Makkah), Karachi, Tehran, Jafari
- Madhab Support: Choose between Standard (Shafiβi/Maliki/Hanbali) and Hanafi for Asr calculation
- Flexible Location: Use geolocation, manual city entry, or exact coordinates
- Per-Prayer Control: Enable/disable pausing for individual prayers
- Time Adjustments: Fine-tune each prayer time with +/- minute offsets
- Optional Resume: Automatically resume paused media after a set duration
- Notifications: Get notified when prayer time arrives
- Site-Specific Handling: Special support for YouTube, Spotify, SoundCloud, Twitch
- Settings Export/Import: Backup and restore your settings as JSON
π¦ Installation
Load as Unpacked Extension (Developer Mode)
- Download or clone this repository
- Open Chrome and navigate to
chrome://extensions
- Enable Developer mode (toggle in top-right corner)
- Click Load unpacked
- Select the
athan-ext folder
- The extension icon should appear in your toolbar
First-Time Setup
- Click the extension icon or right-click β Options
- Configure your location:
- Manual City: Enter your city name (uses default coordinates for Makkah if unrecognized)
- Manual Coordinates: Enter exact latitude/longitude for precise times
- Geolocation: Let the browser detect your location
- Choose your calculation method and madhab
- Enable/disable specific prayers as needed
- Click Save Settings
π§ Configuration Options
Location Settings
| Option |
Description |
| Manual City |
Enter city and country name |
| Manual Coordinates |
Enter latitude, longitude, and timezone |
| Geolocation |
Use browserβs location API |
Calculation Methods
| Method |
Description |
| Muslim World League |
Fajr: 18Β°, Isha: 17Β° |
| ISNA |
Fajr: 15Β°, Isha: 15Β° |
| Egyptian |
Fajr: 19.5Β°, Isha: 17.5Β° |
| Umm al-Qura (Makkah) |
Fajr: 18.5Β°, Isha: 90 min after Maghrib |
| Karachi |
Fajr: 18Β°, Isha: 18Β° |
| Tehran |
Fajr: 17.7Β°, Isha: 14Β°, Maghrib: 4.5Β° |
| Jafari |
Fajr: 16Β°, Isha: 14Β°, Maghrib: 4Β° |
Features
- Notifications: Show browser notification at prayer time
- Auto-Resume: Resume paused media after X minutes (default: OFF)
- Sound: Play system notification sound (no athan audio by default)
π Permissions Explained
| Permission |
Why Itβs Needed |
alarms |
Schedule prayer time alarms that persist when the browser sleeps |
storage |
Save your settings and cached prayer times |
notifications |
Show prayer time notifications |
scripting |
Inject pause script into tabs that donβt have the content script |
tabs |
Query and send messages to all open tabs for media pausing |
<all_urls> |
Access any website to pause media (host permission) |
No data is collected or transmitted. All calculations are done locally and your settings stay on your device.
π§ͺ Testing
Test Pause Function
- Open several tabs with playing media (YouTube, Spotify, etc.)
- Go to the extension Options page
- Click Test Pause Now
- All playing media should pause immediately
Test Alarm Scheduling
- Set a prayer time offset to trigger 1 minute from now
- Wait for the alarm
- A notification should appear and all media should pause
View Scheduled Alarms
Open chrome://extensions, click on βService Workerβ link for this extension, then check the console for alarm logs.
π File Structure
athan-ext/
βββ manifest.json # Extension configuration (MV3)
βββ service_worker.js # Background service worker
βββ content_script.js # Injected into all pages
βββ prayertimes.js # Offline prayer time calculator
βββ options.html # Settings page UI
βββ options.js # Settings page logic
βββ icons/
β βββ icon16.png
β βββ icon48.png
β βββ icon128.png
βββ README.md
β οΈ Limitations
- WebAudio API: Cannot pause audio created via WebAudio API (some games, synthesizers)
- Autoplay Policies: Browser may block auto-resume on some sites due to autoplay restrictions
- Alarm Precision: Chrome alarms have ~1 minute precision; exact-second timing not guaranteed
- Protected Pages: Cannot pause media on
chrome://, chrome-extension://, or about: pages
- Geolocation: Requires HTTPS context; best used from the options page
πͺ Chrome Web Store Policy Compliance
This extension is designed to comply with Chrome Web Store policies:
- β
No remote code execution: All code is bundled locally
- β
No tracking/analytics: Zero data collection
- β
No copyrighted content: No athan audio included by default
- β
Minimal permissions: Only requests whatβs needed
- β
Clear purpose: Single-purpose extension
π Adding Custom Athan Audio
Due to copyright concerns, no athan audio is included by default. To add your own:
- Download or create a short audio file (MP3, OGG, or WAV)
- Rename it to
athan.mp3 and place it in the extension folder
- Modify
service_worker.js to use an offscreen document for audio playback
Note: Chrome MV3 service workers cannot directly play audio. You would need to implement an offscreen document solution.
π€ Contributing
Contributions are welcome! Please ensure your code follows the existing style and includes appropriate comments.
π License
MIT License - feel free to use, modify, and distribute.
π Credits
- Prayer time calculation algorithm based on PrayTimes.org by Hamid Zarrabi-Zadeh
- Made with β€οΈ for the Muslim community
Version: 1.0.0
Manifest Version: 3
Minimum Chrome Version: 102+