2026
Webcamera
A paired macOS and Android application setup that brings the computer's cameras and a USB-connected phone into one workspace. It can preview multiple sources at once, configure video and audio for each, and record them to separate files without installing a system-wide virtual camera.
Project roles
Technologies and tools
- Built an Android app and a macOS app that brings Mac cameras and a USB-connected phone into one workspace. The phone is discovered through ADB; macOS launches its app and manages the stream. The Android source needs neither Wi-Fi nor internet access. Mac cameras run directly through AVFoundation. Preview and recording take place inside Webcamera; it does not install a system-wide virtual camera for use by other apps.
- Implemented discovery of built-in cameras, external USB cameras, virtual cameras already exposed to the system through AVFoundation, and a connected Android device. Sources appear in a sidebar; selected cameras are shown in an adaptive grid, can be started or stopped independently and simultaneously, and can each open in a separate preview window.
- Separated source management into independent controllers with per-source state, capture queues and errors. Synchronized AVFoundation session changes and preview-layer attachment/detachment with a per-session lock, and deferred controller removal until preview teardown completes. This protects capture-session graphs from races during source switching and parallel operation.
- Configured the app to show each local camera's driver-reported resolutions and frame rates. Added front/rear camera selection and four Android video presets: 1920×1080, 1280×720, 960×540 and 640×480, each at 30 fps. Implemented stream reconfiguration when a preset changes and phone torch control for compatible cameras.
- Implemented phone camera and audio capture on Android, hardware H.264 and AAC encoding through MediaCodec, and a foreground service with notification, status, start/stop commands, and reporting of available cameras, sizes and torch capabilities. The default stream is 1280×720 at 30 fps and 4 Mbps; audio is mono AAC-LC at 48 kHz and 128 kbps. If an encoder configuration is unsupported, the implementation tries other advertised color formats and fallback frame rates and bitrates.
- Designed two ADB-forwarded channels: control TCP port 27283 carries versioned newline-delimited JSON commands; media port 27284 carries video and audio in binary packets with a 36-byte header, type, flags, sequence, timestamps and payload length. The protocol covers capability and status requests, configuration, start/stop, key-frame requests, torch control, errors and end-of-stream. The receiver handles partial reads and multiple packets per read, and rejects packets larger than 32 MiB.
- Added an Android transmission queue holding up to 180 encoded frames; when full, it drops the oldest frame to avoid building up stale video. On the Mac, H.264 Annex B is parsed and decoded through VideoToolbox to CVPixelBuffer frames, then displayed with aspect fit in the grid and separate preview windows.
- Added independent resolution, frame-rate, microphone, no-audio, mono/stereo and file-format settings for each source. Connected the phone microphone, built-in and external Mac microphones, audio interfaces and other AVFoundation sources. Implemented live monitoring for local camera microphones and separate left/right RMS meters; routed phone audio to recordings without live monitoring.
- Implemented independent simultaneous recording of selected sources to separate files, plus Start All, Stop All, Record All and Stop Recording controls. Android video is recorded on the Mac with phone audio or a selected macOS microphone, or without audio. AVAssetWriter records media using timestamps normalized relative to the start of each recording.
- Implemented support for MOV and MP4 formats. Android streams are written directly to the selected container with AVAssetWriter; local cameras record to MOV first and use AVAssetExportSession to produce MP4. If export fails, the temporary MOV is retained. Added output-folder selection, filenames containing date, time and camera name, a shortcut to the recordings folder, and default format/microphone settings that can be applied across selected cameras.
- Configured macOS camera/microphone and Android camera/microphone/foreground-service permissions. Prepared scripts to build the APK and macOS-app ZIP, install and launch the apps, check the environment, and diagnose USB/ADB transport; implemented checks for device state, both port forwards and ADB stability over 15 seconds. Configured debug-signed APK and ad hoc-signed macOS package creation with SHA-256 checksums. Wrote Russian and English documentation, a separate protocol specification and materials on architecture and development. Documented Android 5.1/API 22 and macOS 14+ targets and the test systems: Meizu MX5 M575H with Flyme 6.2.0.0G and MacBook Air M2 running macOS Tahoe 26.5.

