Effortless screen sharing via browser - no installation required on viewer devices
Project description
๐ก Sharer - Effortless Screen Sharing
Cast your screen to phones, tablets, laptops, or Smart TVs โ instantly โ using just a browser and a QR code. No installations, no cables, no nonsense.
โจ Features
- ** Zero-install screen sharing** โ Works via browser, no apps needed on viewer devices
- ** Smartphone-friendly** โ Scan QR code and view instantly
- ** Smart TV-ready** โ Works with any device with a browser
- ** Touch-to-click** โ Tap the screen on viewer device to click on host machine
- ** Automatic resolution scaling** โ Looks great on any screen size
- ** Local network only** โ Your screen stays secure on your network
- ** Real-time streaming** โ Low latency WebSocket-based streaming (~10 FPS)
- ** Beautiful UI** โ Modern, responsive interface for both host and viewers
- ** QR & URL access** โ Multiple ways to connect viewers
Installation
pip install sharer
System Requirements
- Python: 3.7 or higher
- Operating Systems: Windows, macOS, Linux
- Network: Local network connectivity
Platform-Specific Setup
macOS:
# Grant Screen Recording permission
# System Preferences โ Security & Privacy โ Privacy โ Screen Recording
# Add Terminal or your Python IDE
# Grant Accessibility permission for mouse control
# System Preferences โ Security & Privacy โ Privacy โ Accessibility
Linux:
# Install X11 dependencies
sudo apt-get update
sudo apt-get install python3-xlib python3-dev scrot
# For Wayland users
sudo apt-get install xwayland
Windows:
- No additional setup required
- May need to allow Python through Windows Firewall when prompted
Quick Start
Basic Usage
Simply run:
sharer
Or as a Python module:
python -m sharer
That's it! The app will:
- Open a control panel in your browser automatically
- Display a QR code for easy scanning
- Show the viewer URL
- Start streaming your screen in real-time
Viewing the Screen
Method 1: Scan QR Code (Easiest)
- Open your phone's camera app
- Point it at the QR code on the host screen
- Tap the notification to open in browser
- Screen appears instantly!
Method 2: Enter URL Manually
- On any device, open a web browser
- Navigate to the URL shown on the host screen
- Example:
http://192.168.1.100:5000/view
Controlling the Host
- Click/Tap anywhere on the viewer screen
- The click will be executed on the host machine at the corresponding position
- Perfect for presentations, demos, or remote support
๐ฏ Use Cases
Presentations & Demos
- Share slides to audience devices
- Interactive product demonstrations
- Conference presentations
Remote Support
- Help family/friends with tech issues
- IT support and troubleshooting
- Remote tutoring
Multi-Device Workflows
- Use tablet as second screen
- Monitor dashboards on multiple devices
- Cast to Smart TV browser
Collaboration
- Share your screen in meetings
- Code reviews and pair programming
- Design feedback sessions
Entertainment
- Stream gameplay to other devices
- Watch content on bigger screens
- Share photos/videos with friends
Education
- Share teaching content to students
- Interactive lessons
- Student device monitoring
๐ Detailed Usage
Starting the Server
# Default settings (port 5000)
sharer
# The server will:
# - Bind to 0.0.0.0:5000 (accessible on local network)
# - Auto-detect your local IP address
# - Generate a unique QR code
# - Open control panel in default browser
Control Panel Features
When you run sharer, the control panel shows:
- QR Code - Large, scannable code for instant connection
- Viewer URL - Direct link to share
- Active Viewers Count - See who's connected in real-time
- Local IP Address - Your machine's network address
- Instructions - Quick how-to guide
Viewer Interface
The viewer page provides:
- Full-screen display - Your screen fills the viewer's browser
- Responsive scaling - Automatically fits any screen size
- Touch/click support - Tap to interact
- Connection status - Live connection indicator
- Click feedback - Visual pulse effect on clicks
Stopping the Server
Press Ctrl+C in the terminal to stop sharing:
Press Ctrl+C to stop
^C
Sharer stopped. Thanks for using!
Advanced Configuration
Custom Port
from sharer.server import ScreenSharer
sharer = ScreenSharer()
sharer.port = 8080 # Custom port instead of default 5000
sharer.run()
Programmatic Usage
from sharer import start_server
# Start with default settings
start_server()
Integration Example
import threading
from sharer import start_server
def start_background_sharing():
"""Start screen sharing in a background thread"""
thread = threading.Thread(target=start_server, daemon=True)
thread.start()
print("Screen sharing started in background")
if __name__ == '__main__':
start_background_sharing()
# Your application continues running
# Screen sharing runs in parallel
Custom Frame Rate
Edit the capture loop in server.py:
# In screen_capture_loop method
time.sleep(0.1) # 10 FPS (default)
time.sleep(0.05) # 20 FPS (smoother, more bandwidth)
time.sleep(0.2) # 5 FPS (lower bandwidth)
Adjust Image Quality
Edit the capture method in server.py:
# In capture_screen method
img.save(buffer, format='JPEG', quality=70, optimize=True) # Default
img.save(buffer, format='JPEG', quality=50, optimize=True) # Lower quality, faster
img.save(buffer, format='JPEG', quality=90, optimize=True) # Higher quality, slower
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Host PC โ โ Viewer Device โ
โ โ โ โ
โ โโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโ โ
โ โ Screen โ โ โ โ Browser โ โ
โ โ Capture โ โ WebSocket โ โ Display โ โ
โ โ (mss) โโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโบโ โ โ
โ โโโโโโโโโโโโโโ โ JPEG Frames โ โโโโโโโโโโโโโโ โ
โ โ (~10 FPS) โ โ โ
โ โโโโโโโโโโโโโโ โ โ โ โ
โ โ Mouse โ โ โ โโโโโโโผโโโโโโโ โ
โ โ Control โโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโ Touch/ โ โ
โ โ (PyAutoGUI)โ โ Click Events โ โ Click โ โ
โ โโโโโโโโโโโโโโ โ {x, y coords} โ โโโโโโโโโโโโโโ โ
โ โ โ โ
โ Flask + SocketIOโ โ JavaScript โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
Technology Stack
-
Backend: Python 3.7+
- Flask (web framework)
- Flask-SocketIO (WebSocket communication)
- mss (fast screen capture)
- Pillow (image processing)
- PyAutoGUI (mouse control)
- qrcode (QR code generation)
-
Frontend: Vanilla JavaScript + HTML5
- Socket.IO client
- Canvas/Image rendering
- Touch event handling
Security Considerations
Network Security
- Local Network Only: Sharer binds to your local network by default
- No Internet Exposure: Does not expose your screen to the internet
- Firewall: Ensure port 5000 is accessible only on trusted networks
Access Control
- No Built-in Authentication: Anyone on your network can view/control
- Trust-based: Only use on trusted networks with trusted users
- Mouse Control: Viewers can click on your screen - use responsibly
Best Practices
- Only run on trusted private networks (home, office)
- Stop the server when not in use
- Be aware of sensitive information on screen
- Don't use on public WiFi networks
- Don't share viewer URLs publicly
Adding Authentication (Advanced)
# Example: Token-based authentication
from functools import wraps
from flask import request, abort
SECRET_TOKEN = "your-secret-token-here"
def require_token(f):
@wraps(f)
def decorated(*args, **kwargs):
token = request.args.get('token')
if token != SECRET_TOKEN:
abort(401)
return f(*args, **kwargs)
return decorated
# Apply to viewer route
@app.route('/view')
@require_token
def view():
return render_template_string(VIEWER_HTML)
Troubleshooting
Connection Issues
Problem: "Connection Failed" or "Cannot connect to server"
Solutions:
- Ensure both devices are on the same WiFi network
- Check if firewall is blocking port 5000
- Try accessing via IP address instead of hostname
- Verify the server is running (check terminal output)
- Disable VPN temporarily
Windows Firewall:
# Allow Python through firewall when prompted
# Or manually add exception in Windows Defender Firewall settings
Screen Capture Issues
Problem: "No screen capture" or blank screen
macOS:
# Grant Screen Recording permission
# System Preferences โ Security & Privacy โ Privacy โ Screen Recording
# Add Terminal, iTerm, or your Python IDE
# Restart the application
Linux:
# Install required packages
sudo apt-get install python3-xlib scrot
# For Wayland
export QT_QPA_PLATFORM=wayland
# Or use XWayland
Windows:
- Usually works out of the box
- Check if another screen capture app is running
Click/Mouse Control Issues
Problem: Clicks not registering on host
macOS:
# Grant Accessibility permission
# System Preferences โ Security & Privacy โ Privacy โ Accessibility
# Add Terminal or Python IDE
# Restart the application
Linux:
# May need to run with sudo (not recommended for security)
# Or configure proper permissions for input devices
sudo usermod -a -G input $USER
# Log out and back in
Windows:
- PyAutoGUI should work without additional setup
- Ensure no other automation tools are interfering
Performance Issues
Problem: Lag, stuttering, or slow frame rate
Solutions:
- Reduce JPEG quality (edit
server.py, set quality to 50-60) - Lower frame rate (increase sleep time to 0.2 for 5 FPS)
- Close unnecessary applications on host
- Use wired Ethernet connection for host if possible
- Ensure strong WiFi signal for viewers
- Reduce screen resolution on host machine
Port Already in Use
Problem: "Address already in use" error
Solution:
# Find process using port 5000
# Linux/macOS:
lsof -i :5000
kill -9 <PID>
# Windows:
netstat -ano | findstr :5000
taskkill /PID <PID> /F
# Or use a different port in your code
Dependencies Installation Fails
Problem: pip install fails for dependencies
Solutions:
# Upgrade pip
python -m pip install --upgrade pip
# Install wheel
pip install wheel
# macOS: Install Xcode Command Line Tools
xcode-select --install
# Linux: Install build dependencies
sudo apt-get install python3-dev build-essential
Performance Metrics
Typical performance on standard hardware:
| Metric | Value | Notes |
|---|---|---|
| Frame Rate | 8-12 FPS | Adjustable |
| Latency | 100-300ms | Depends on network |
| Bandwidth | 1-5 Mbps | Per viewer |
| CPU Usage | 5-15% | Host machine |
| Resolution | 1:1 | Scales automatically |
Dependencies
Flask>=2.0.0 # Web framework
flask-socketio>=5.0.0 # WebSocket support
python-socketio>=5.0.0 # SocketIO protocol
mss>=6.0.0 # Fast cross-platform screen capture
Pillow>=9.0.0 # Image processing
qrcode[pil]>=7.0.0 # QR code generation
pyautogui>=0.9.53 # Mouse/keyboard control
Contributing
Contributions are welcome! We'd love your help making Sharer better.
How to Contribute
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Development Setup
# Clone your fork
git clone https://github.com/niterousnebula/sharer.git
cd sharer
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install development dependencies
pip install pytest black flake8
# Run tests
pytest
# Format code
black sharer/
# Lint
flake8 sharer/
Areas for Contribution
- Bug fixes
- New features
- Documentation improvements
- Test coverage
- Internationalization
- UI/UX enhancements
License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Sharer Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
Acknowledgments
- Built with Python, Flask, and WebSockets
- Inspired by the need for simple, cable-free screen sharing
- Thanks to the open-source community
- Special thanks to all contributors and users!
Getting Help
- Check this README first
- Search existing GitHub issues
- Create a new issue with details:
- Your OS and Python version
- Complete error message
- Steps to reproduce
Changelog
v1.0.0 (2024-01-24)
- Initial release
- Zero-install browser-based sharing
- QR code generation
- Touch-to-click functionality
- Auto-scaling for all devices
- WebSocket real-time streaming
Star History
If you find Sharer useful, please consider giving it a star โญ on GitHub!
๐ Sponsors
Become a sponsor to support ongoing development!
Made with โค๏ธ for effortless screen sharing
Star this repo if you find it useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters