npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-sony-camera

v0.2.1

Published

Expo and React Native Sony camera module with Android USB UVC streaming, USB PTP2, ScalarWebAPI live view, remote shutter, and JPEG capture

Readme

expo-sony-camera — Sony camera control for Expo and React Native

Build a mobile app that talks to a Sony camera with Expo and React Native. This Expo native module provides Sony camera control, tethered shooting, remote shutter capture, native JPEG live view, and captured-image transfer for Android and iOS apps. It also provides direct Android USB Video Class (UVC) preview for cameras such as the Sony a6700 in USB Streaming mode.

It is designed for developers building a Sony Alpha camera app, Sony remote-camera workflow, mobile product-photography tool, camera monitor, remote shutter, or camera capture integration without writing the Android Kotlin and iOS Swift bridge from scratch. The package uses Sony Camera Remote Command-compatible PTP transports and Sony ScalarWebAPI where the active camera advertises those capabilities.

This package is experimental (0.x). It contains native protocol work for:

  • Android USB Camera Control PTP2
  • Android direct USB UVC/MJPEG streaming
  • Android Sony ScalarWebAPI over Wi-Fi Direct
  • iOS wired Camera Control PTP2 through ImageCaptureCore
  • iOS external-camera streaming through AVFoundation (source implementation; physical a6700 certification pending)

Tested protocol terminology and camera families include Sony A7 III (ILCE-7M3), Sony a6700 (ILCE-6700), Camera Control PTP2, PTP/IP, PTP3, ScalarWebAPI, USB PTP camera, Wi-Fi Direct camera, Sony Alpha live view, remote shutter, and JPEG capture. PTP3 is documented as a roadmap adapter, not a supported 0.1.x transport.

Support is capability-driven. A camera model name alone is not treated as proof of protocol support, and a successful package build is not hardware certification.

What works today

| Capability | Android USB PTP2 | Android ScalarWebAPI | iOS wired PTP2 | | ------------------------------- | ----------------------------- | -------------------------------------------------------- | ------------------------------------ | | Detect/connect | Implemented | Implemented for known Wi-Fi Direct addresses | Implemented through ImageCaptureCore | | Native JPEG live view | Implemented | Implemented | Implemented | | App-triggered still capture | Implemented | Implemented when actTakePicture is advertised | Implemented | | Transfer captured JPEG | Implemented | Implemented | Implemented | | Camera-body shutter import | Implemented by polling D215 | Not implemented | Implemented by polling D215 | | Half-press/focus before capture | Implemented | Implemented when advertised | Implemented | | Coordinate tap-to-focus | Not implemented | Implemented only when setTouchAFPosition is advertised | Not implemented | | Automatic reconnect | Experimental | Bounded reconnect implemented | Experimental |

“Implemented” means the code path exists. It does not mean every camera, firmware, phone, cable, or network path is certified. See the support matrix for evidence and limitations.

Who should use this

This package is for an Expo or React Native developer who needs to:

  • connect an Android phone to a Sony camera over USB and Camera Control PTP2;
  • use Sony ScalarWebAPI over a camera's Wi-Fi Direct network;
  • render a Sony camera live view inside a native mobile app;
  • trigger a Sony camera shutter from a phone;
  • transfer Sony camera JPEGs into a React Native or Expo photo workflow;
  • build a Sony Alpha tethered-shooting, remote-monitor, product-photography, or camera control app with a reusable native module.

It is not a browser camera API or a promise of universal Sony camera compatibility. UVC streaming and remote camera control are separate module surfaces because USB Streaming mode does not expose the PTP remote-control interface.

Installation

npx expo install expo-sony-camera

Then add the package to the app's Expo plugins:

{
  "expo": {
    "plugins": ["expo-sony-camera"]
  }
}

Create a development build after installing because this package contains native code.

Example

The example/ directory is a small Expo app that exercises connection, live view, and still capture. From the repository root:

npm install
npm run build
cd example
npm install
npx expo run:android

The example is intentionally not a full camera application. It demonstrates the module surface that another Expo app can build on top of.

JavaScript API

import SonyCamera, { SonyCameraView } from 'expo-sony-camera';

const state = SonyCamera?.getState();
await SonyCamera?.connect();
await SonyCamera?.startLiveView();
const photo = await SonyCamera?.capturePhoto();
await SonyCamera?.stopLiveView();
await SonyCamera?.disconnect();

<SonyCameraView active style={{ flex: 1 }} />;

Direct USB streaming uses the separate UVC surface:

import { SonyUsbStreaming, SonyUsbStreamingView } from 'expo-sony-camera';

await SonyUsbStreaming?.startStreaming();
<SonyUsbStreamingView active style={{ flex: 1 }} />;

On a Sony a6700, select USB Connection Mode > USB Streaming, set USB Power Supply to Off, connect directly with a data-capable USB-C cable, and wait for the camera to show Streaming: Output. See USB streaming.

The module emits onStateChanged, onDeviceAttached, and onPhotoCaptured events. On web, the module is unavailable and the view renders nothing.

focusAt(x, y, viewWidth, viewHeight) currently exists only on Android and succeeds only when the active ScalarWebAPI camera advertises coordinate touch focus. Callers must handle unsupported; the module does not pretend that center-focus is coordinate focus. SonyConnectOptions and the candidate/capability types reserve the future protocol-selection contract. Android now applies transport/protocol preference hints when they are requested; iOS remains USB PTP2-only in this release and rejects unsupported transport/protocol preferences explicitly.

Documentation

Camera setup

For USB PTP2, enable the camera's PC Remote mode, return to the normal shooting screen, and use a data-capable USB connection. Android requires USB host support and camera permission. iOS requires the host app to be open and ImageCaptureCore to expose PTP command pass-through for the attached camera.

For ScalarWebAPI, connect the phone to the camera's Wi-Fi Direct network before opening the example app. The camera must expose the documented ScalarWebAPI descriptor and live view endpoint. Android discovery uses SSDP multicast (urn:schemas-sony-com:service:ScalarWebAPI:1) and falls back to the fixed Wi-Fi Direct addresses 192.168.122.1 and 192.168.0.1.

Android cleartext traffic: The library manifest sets android:usesCleartextTraffic="true". This is required because Sony camera Wi-Fi networks do not provide HTTPS. The setting is scoped to the library; it does not affect other network traffic in the host app.

Development

npm install
npm run lint
npm run build
npm test
npm pack --dry-run

The Android unit tests cover the PTP container and JPEG codec. Sustained live view, capture, reconnect, camera power-off, cable removal, and permission recovery require physical-device tests and are not claimed by the automated suite.

Scope and limitations

  • Wireless PTP3 is not implemented yet.
  • iOS wireless transports are not implemented yet.
  • Camera property control, movie control, and media browsing are not part of the first public API.
  • PTP live view and UVC streaming are independent paths. PTP provides camera control; UVC provides a continuous video feed while the camera is in USB Streaming mode.
  • Android UVC is physically proven on one arm64 Samsung/a6700 combination. Other ABIs, phones, firmware versions, USB audio capture, encoding, and network publishing remain explicit release gates.
  • The module cannot add a control that a camera/firmware/mode does not advertise.
  • The module does not bypass pairing, network permissions, camera licensing, or Sony's per-model command compatibility.
  • Sony SDK binaries and proprietary sample code are not bundled.
  • Sony announced in Camera Remote Command 2.02.00 that Camera Control PTP2 commands may become unavailable on some models from 2027 and are not recommended for new support without checking the supplied compatibility materials. See Sony Camera Remote Command.
  • Review Sony's current documentation, model/firmware compatibility, application process, and license terms before shipping a product built on this module.

License

MIT. See LICENSE.