Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

📹 Mobile CCTV — Turn Your Phone Into a Surveillance Camera

HTML5 CSS3 JavaScript IndexedDB PWA Status Mobile

Mobile CCTV turns any smartphone into a fully functional surveillance camera. Record high-quality video with audio, browse saved recordings, play them back with a built-in video player, and download clips for offline use. Everything runs entirely in the browser using IndexedDB for storage — no server, no uploads, no cloud dependency.


🎮 Live Demo

🔗 Try Mobile CCTV


📑 Table of Contents

  • Features
  • Screenshots
  • Technologies
  • Project Structure
  • How It Works
  • Installation
  • Future Improvements
  • Contributing
  • License
  • Author

✨ Features

📹 Camera & Recording

  • Full Camera Access — Front and rear camera support with live preview feed
  • High-Quality Recording — Record video with audio at up to 1080p resolution
  • Recording Timer — On-screen timer displays elapsed recording duration in real time
  • Camera Switching — Toggle between front and rear cameras while recording
  • Screen Wake Lock — Prevents the screen from sleeping during active recording
  • Recording Time Limit — Automatically stops recording after the configured max duration

🎬 Playback & Management

  • Built-In Video Player — Play saved recordings directly in the app with play/pause, seek, and speed controls
  • Playback Speed Control — Watch recordings at 0.5x, 1x, 1.5x, or 2x speed
  • Download Recordings — Save any recorded clip to your device as a .webm file
  • Local Storage via IndexedDB — All recordings stored locally in the browser database, no server uploads
  • Storage Management — View total, used, and free storage with a visual usage bar
  • Auto-Delete Old Recordings — Automatically removes oldest clips when storage limit is reached

⚙️ Configuration & UX

  • Configurable Settings — Adjust video quality, max recording time, storage limit, and auto-delete behavior
  • Responsive Bottom Sheets — Clean sliding panels for recordings list, system info, and settings
  • Toast Notifications — Non-intrusive feedback for all actions
  • Dark Professional UI — Gradient accents on a deep navy background with glassmorphism effects
  • Fully Client-Side — No backend, no cloud, all data stays on your device
  • Single HTML File — Zero dependencies, just open and use

🚀 Quick Start

# Clone the repository
git clone https://github.com/dhruvpandit46/CCTV.git

# Navigate to the project
cd CCTV

# Open in your browser
open index.html

That's it! No installation, no build step, no server required. Works best on mobile devices with a camera.


⚙️ Technologies Used

Core Technologies

Technology Purpose
HTML5 Semantic structure with media capture APIs
CSS3 Custom properties, gradients, glassmorphism, animations, responsive design
JavaScript (ES6) Complete application logic with class-based architecture

Web APIs

API Purpose
MediaDevices API Camera and microphone access (getUserMedia)
MediaRecorder API Video recording with configurable quality
IndexedDB Persistent local storage for video blobs
Wake Lock API Prevent screen sleep during recording
WebM Format Efficient video encoding with VP8/VP9 codecs

📂 Project Structure

CCTV/
│
├── index.html          # Complete Mobile CCTV application
├── images/             # App icons and assets (optional)
└── README.md           # Project documentation

⚡ How It Works

1️⃣ Starting the Camera

Open App → Tap "Start Camera" → Grant Permissions → Live Feed Appears
  1. Open the app and tap Start Camera or tap the camera preview area
  2. Grant camera and microphone permissions when prompted
  3. The live camera feed appears with a timestamp overlay
  4. The status dot turns green indicating the camera is active

2️⃣ Recording Video

Tap Record → Timer Starts → Recording in Progress → Tap Stop → Auto-Saved
  1. With the camera active, tap the green Record button
  2. A recording timer appears showing elapsed time
  3. The status dot turns red and pulses to indicate active recording
  4. Tap the red Stop button to end recording
  5. The recording is automatically saved to IndexedDB

3️⃣ Switching Cameras

Tap 🔄 Button → Camera Toggles → Continue Recording
  1. Tap the camera switch button (🔄) in the bottom-right corner
  2. The feed toggles between front and rear cameras
  3. Camera switching works even during active recording

4️⃣ Managing Recordings

Tap 📁 → View List → Play/Download/Delete
  1. Tap the folder icon (📁) to open the recordings list
  2. Each recording shows the date, time, duration, and file size
  3. Play — Opens the built-in video player
  4. Save — Downloads the recording as a .webm file
  5. Delete — Removes the recording after confirmation

5️⃣ Playing Recordings

Tap Play → Video Player Opens → Control Playback
  1. Tap Play on any recording in the list
  2. The video player opens with:
    • Play/Pause with large central button
    • Rewind/Forward 5 seconds
    • Adjustable playback speed (0.5x, 1x, 1.5x, 2x)
    • Clickable progress bar for seeking
    • Current time and total duration display

6️⃣ Storage Management

Tap 📊 → View Usage → Auto-Delete (if enabled)
  1. Tap the info icon (📊) to view system info
  2. See total storage, used storage, free storage, and recording quality
  3. A visual storage bar shows usage percentage
  4. When auto-delete is enabled, oldest recordings are removed when the limit is reached

7️⃣ Settings

Tap ⚙️ → Configure → Save
  1. Tap the gear icon (⚙️) to open settings
  2. Configure:
    • Video Quality — 480p, 720p, or 1080p
    • Max Recording Time — 1 to 24 hours
    • Storage Limit — 1 to 100 GB
    • Auto-Delete — Enable or disable automatic cleanup
  3. Tap Save Settings to apply

🔄 Application Flow Diagram

┌─────────────────────────────────────────────────────────────┐
│                    Mobile CCTV App                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────┐    ┌──────────────────┐                    │
│  │ Start Camera │───▶│  Live Preview  │                    │
│  └─────────────┘    └──────────────────┘                    │
│         │                    │                              │
│         ▼                    ▼                              │
│  ┌─────────────┐    ┌──────────────────┐                    │
│  │  Record     │───▶│  Recording Timer │                   │
│  └─────────────┘    └──────────────────┘                    │
│         │                    │                              │
│         ▼                    ▼                              │
│  ┌─────────────┐    ┌──────────────────┐                    │
│  │  Stop       │───▶│Save to IndexedDB│                    │
│  └─────────────┘    └──────────────────┘                    │
│                              │                              │
│                              ▼                              │
│                     ┌──────────────────┐                    │
│                     │  Recordings List │                    │
│                     └──────────────────┘                    │
│                              │                              │
│              ┌───────────────┼───────────────┐              │
│              ▼               ▼               ▼              │
│       ┌───────────┐   ┌───────────┐   ┌───────────┐         │
│       │  Play     │   │  Download │   │  Delete   │         │
│       └───────────┘   └───────────┘   └───────────┘         │
│              │                                              │
│              ▼                                              │
│       ┌──────────────────┐                                  │
│       │  Video Player    │                                  │
│       │  - Play/Pause    │                                  │
│       │  - Speed Control │                                  │
│       │  - Seek Bar      │                                  │
│       └──────────────────┘                                  │
└─────────────────────────────────────────────────────────────┘

📱 UI Components

Component Description
Header App title with live status indicator
Video Preview Full-screen camera feed with overlay
Info Overlay Live timestamp display
Recording Timer Elapsed time during recording
Main Controls Start Camera, Record, Stop buttons
Secondary Controls Recordings, Info, Settings buttons
Bottom Sheets Sliding panels for lists and settings
Video Player Full-screen playback with controls
Toast Notifications Non-intrusive feedback messages

🎨 Visual Design

Theme

  • 🌑 Deep Navy Background — Gradient from #0f0f23 to #1a1a2e
  • 💙 Cyan Accents — #00d4ff for primary actions
  • 💚 Green Accents — #00ff88 for success states
  • ❤️ Red Accents — #ff0080 for recording/danger
  • Glassmorphism — Frosted glass effects on headers and sheets
  • 📱 Mobile-First — Optimized for touch interaction

Animations

  • 🔄 Smooth transitions for bottom sheets
  • 💫 Pulse animation for status indicators
  • ✨ Fade effects for toast notifications
  • 🎯 Scale feedback on button taps

📈 Feature Matrix

Feature Status
Camera Access ✅ Complete
Video Recording ✅ Complete
Audio Recording ✅ Complete
Camera Switching ✅ Complete
Recording Timer ✅ Complete
Screen Wake Lock ✅ Complete
Video Playback ✅ Complete
Playback Speed Control ✅ Complete
Download Recordings ✅ Complete
IndexedDB Storage ✅ Complete
Storage Management ✅ Complete
Auto-Delete ✅ Complete
Settings Panel ✅ Complete
Toast Notifications ✅ Complete
Mobile Responsive ✅ Complete
Dark Theme ✅ Complete
Touch Controls ✅ Complete

🚧 Future Improvements

Coming Soon

  • 🎯 Motion detection with alert notifications
  • 🌙 Night vision mode toggle
  • ⏱️ Timelapse recording mode
  • 🔄 Background recording (PWA service worker)
  • ☁️ Cloud backup integration (optional)
  • 🔒 Password-protected recordings

Planned Enhancements

  • 📹 Multi-camera grid view
  • ⏰ Scheduled recording times
  • 📡 Live streaming to another device
  • 🎵 Audio-only recording mode
  • 📋 Recording categories and tags
  • 📦 Export as MP4 format
  • 📱 Picture-in-picture mode
  • 🔊 Audio level indicator

🔒 Privacy & Security

  • 🔐 100% Local — All recordings stay on your device
  • 🚫 No Uploads — No data sent to any server
  • 📡 No Tracking — No analytics or tracking scripts
  • 🗑️ User-Controlled — Delete recordings anytime
  • 🔒 Secure Context — Requires HTTPS for camera access
  • 👁️ Private — No third-party access to your recordings

🌐 Browser Compatibility

Supported Browsers

  • ✅ Google Chrome (Desktop & Mobile)
  • ✅ Microsoft Edge
  • ✅ Mozilla Firefox
  • ✅ Safari (14+)
  • ✅ Opera
  • ✅ Brave
  • ✅ Samsung Internet

Requirements

  • 📹 Camera hardware (front or rear)
  • 🎙️ Microphone for audio recording
  • 🔒 HTTPS connection (or localhost)
  • 💾 100MB+ free storage

🤝 Contributing

Contributions, issues, and feature requests are welcome!

How to Contribute

  1. Fork the repository
git fork https://github.com/dhruvpandit46/CCTV.git
  1. Create a feature branch
git checkout -b feature/your-feature
  1. Make your changes and test thoroughly

  2. Commit your changes

git commit -m "Add your feature"
  1. Push to your branch
git push origin feature/your-feature
  1. Open a Pull Request

📜 License

This project is licensed under the MIT License.

MIT © 2026 Dhruv Pandit

See the LICENSE file for full license details.


👨‍💻 Author

Dhruv Pandit


⭐ Support

If you found Mobile CCTV useful, please consider giving it a ⭐ on GitHub!

It helps others discover the project and supports future development.

About

Turn any smartphone into a fully functional surveillance camera. Record high-quality video with audio, browse and play saved recordings with a built-in video player, download clips, and manage storage — all locally in the browser using IndexedDB. Features camera switching, configurable video quality up to 1080p, recording timer.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages