fourbrains_camera_view 0.1.2 copy "fourbrains_camera_view: ^0.1.2" to clipboard
fourbrains_camera_view: ^0.1.2 copied to clipboard

Live camera feed from the 4Brains Camera Controller over WebRTC — one widget, API-key auth, and auto-reconnect. Receive the stream on any device.

fourbrains_camera_view #

Live camera feed from the 4Brains Camera Controller over WebRTC, in one Flutter widget. Point it at your server and room with an API key — signaling is handled for you, and the video flows peer-to-peer (the server only brokers the handshake, so it never becomes a latency bottleneck).

Works on any Flutter target flutter_webrtc supports — iPad, phone, kiosk, TV.

Install #

dependencies:
  fourbrains_camera_view: ^0.1.0

This pulls in flutter_webrtc, which needs a little native setup in your app.

iOS #

ios/Podfile:

platform :ios, '13.0'

ios/Runner/Info.plist — allow the LAN connection and satisfy the WebRTC engine (the app only receives, but the plugin links these APIs):

<key>NSAppTransportSecurity</key>
<dict><key>NSAllowsLocalNetworking</key><true/></dict>
<key>NSCameraUsageDescription</key>
<string>Required by the video engine; this app only receives the live view.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Required by the video engine; this app only receives the live view.</string>

Android #

android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Set minSdkVersion 23 (or higher) in android/app/build.gradle.

Use #

import 'package:fourbrains_camera_view/fourbrains_camera_view.dart';

FourBrainsCameraView(
  server: 'http://192.168.1.42:3000', // the server's LAN URL
  room: 'camera',                     // the room the controller broadcasts to
  apiKey: 'your-api-key',             // your 4Brains API key
  fit: CameraFit.cover,               // contain (default) or cover
  onStatus: (status) {
    // CameraStreamStatus.connecting | live | reconnecting
  },
  onSize: (w, h) => debugPrint('feed is ${w}x$h'),
)

Drop it into any layout — a bounded box, Positioned.fill, or an AspectRatio. It reconnects on its own if the network drops or the broadcaster restarts.

API #

Property
server String Signaling server base URL.
room String Room shared with the broadcaster.
apiKey String Sent in the socket handshake to authenticate.
fit CameraFit contain (letterbox) or cover (crop).
iceServers List<Map> STUN/TURN. Empty for LAN; add for cross-network.
onStatus callback Connection state changes.
onSize callback Video pixel size.
placeholder WidgetBuilder Shown before the first frame.

How it fits together #

Camera → 4Brains Camera Controller (broadcaster)      your app (this widget)
                    │  SDP/ICE via signaling server        │
                    └──────────────► server ◄──────────────┘
                       video is peer-to-peer, not via the server

The desktop controller captures the camera and broadcasts; your app is a viewer. Run the server locally (see the server's DOCKER.md); get an API key from your 4Brains dashboard.

LAN vs. internet #

Default iceServers is empty — correct for devices on the same Wi-Fi (they connect directly via host candidates). To stream across networks you need a TURN server; pass it via iceServers.

0
likes
155
points
99
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Live camera feed from the 4Brains Camera Controller over WebRTC — one widget, API-key auth, and auto-reconnect. Receive the stream on any device.

Repository
View/report issues

Topics

#webrtc #camera #streaming #socket-io

License

MIT (license)

Dependencies

flutter, flutter_webrtc, socket_io_client

More

Packages that depend on fourbrains_camera_view