A native Android app for recording golf swings with HTTP API control, designed to run entirely on your Pixel 9 phone.
- Simple Setup: Mount your phone on a tripod, no external camera required
- HTTP API Control: Trigger recordings via external HTTP requests (from simulator, web browser, or custom triggers)
- High-Quality Recording: Uses phone's camera with configurable resolution and FPS
- In-App Playback: Review your swings immediately
- Metadata Tracking: Automatic timestamp and settings tracking for each recording
- Native Android app (Kotlin)
- Embedded HTTP server (Ktor) for external trigger control
- Camera2 API for high-quality video recording
- Configurable recording settings (resolution, FPS, duration)
- In-app recording management and playback
- Automatic metadata storage (JSON format)
- Foreground service keeps server running
- Language: Kotlin
- Camera: CameraX Video API
- HTTP Server: Ktor (embedded Netty server)
- UI: Material Design, ViewBinding
- Video Playback: ExoPlayer (planned)
- Storage: Local file system with JSON metadata
The app runs an HTTP server on port 8080 when started:
Get current camera and recording status.
Response:
{
"recording": false,
"config": {
"duration": 5
}
}Start a new recording.
Response:
{
"success": true,
"message": "Recording started",
"duration": 5
}List all recordings.
Response:
{
"recordings": [
{
"filename": "swing_20241022_143022.mp4",
"timestamp": "2024-10-22 14:30:22",
"duration": 5,
"fileSize": 12345678
}
]
}Delete a specific recording.
Delete all recordings.
Settings are stored in config.json in the app's private storage:
{
"duration": 5
}- duration: Recording length in seconds
Note: Resolution, FPS, and quality are automatically handled by the Pixel 9's slow-motion camera mode. The app uses the highest quality available for the best slow-motion capture.
- Install the app on your Android phone
- Grant permissions (Camera, Microphone, Notifications)
- Start the HTTP server from the app
- Note the IP address displayed (e.g.,
http://192.168.1.100:8080) - Trigger recordings via HTTP:
curl -X POST http://192.168.1.100:8080/api/record
- Review recordings in the app or via API
- Android Studio Hedgehog or later
- Android SDK 34
- Gradle 8.2+
- JDK 17
- Open Android Studio
- File → Open → select
swing-camdirectory - Wait for Gradle sync to complete
- Connect Pixel 9 via USB
- Click Run (
▶️ ) button - Select your device and wait for installation
- CAMERA: Required for video recording
- RECORD_AUDIO: Required for audio in videos
- INTERNET: Required for HTTP server
- POST_NOTIFICATIONS: Required for foreground service notification (Android 13+)
app/src/main/java/com/example/swingcam/
├── MainActivity.kt # Main activity and app orchestration
├── camera/
│ └── CameraManager.kt # Camera2 API wrapper
├── data/
│ ├── Config.kt # Configuration data class
│ ├── RecordingMetadata.kt # Metadata tracking
│ └── RecordingRepository.kt # Recording management
├── server/
│ └── HttpServerService.kt # Ktor HTTP server
└── ui/
└── RecordingAdapter.kt # RecyclerView adapter
- Simplicity First: One device, minimal configuration
- Phone-Native: Leverages Pixel 9's excellent slow-motion capabilities
- API-Driven: HTTP triggers allow external control (simulator, web UI, scripts)
- Focused: Just recording and playback, no unnecessary features
See TODO.md for the complete feature backlog and planned enhancements.
- Quick Start Guide - Get up and running in 5 minutes
- Usage Guide - Detailed API documentation and examples
- Architecture - Project structure and design decisions
- CLAUDE.md - Development guide for AI assistants
- TODO.md - Feature requests and backlog
- Simple setup: Just your phone on a tripod
- Excellent quality: Pixel 9's slow-motion mode is optimized automatically
- Portable: Easy to bring to the course, range, or simulator
- No complexity: Just set duration, let the phone handle camera settings
- API control: Trigger recordings from your golf simulator or other apps
MIT License