rtmpstreamer 0.1.0 copy "rtmpstreamer: ^0.1.0" to clipboard
rtmpstreamer: ^0.1.0 copied to clipboard

Flutter plugin for Android RTMP streaming with camera preview, screen sharing, orientation control, raw encoded frames, and chunked capture.

rtmpstreamer #

Flutter plugin for Android RTMP streaming with camera preview, screen sharing, orientation control, native events, raw encoded frames, and chunked frame capture support on Android.

Current platform support:

Android only

Install #

From Git:

dependencies:
  rtmpstreamer:
    git:
      url: https://github.com/gitlad11/flutter_rtmp_screensharing.git
      path: packages/rtmpstreamer
      ref: v0.1.0

After publishing on pub.dev:

dependencies:
  rtmpstreamer: ^0.1.0

Android Permissions #

The plugin manifest declares the required permissions and foreground service. Your app still needs to request runtime permissions when Android asks for them.

Required capabilities:

CAMERA
RECORD_AUDIO
INTERNET
FOREGROUND_SERVICE
FOREGROUND_SERVICE_MEDIA_PROJECTION
POST_NOTIFICATIONS

Usage #

Import:

import 'package:rtmpstreamer/rtmpstreamer.dart';

Add preview:

const AspectRatio(
  aspectRatio: 16 / 9,
  child: RtmpCameraPreview(),
)

Configure and start:

await RtmpStreamer.updateStreamSettings(
  const RtmpStreamSettings(
    width: 1280,
    height: 720,
    fps: 30,
    bitrate: 2500000,
    orientation: RtmpOrientation.landscape,
  ),
);

await RtmpStreamer.startPreviewCamera();
await RtmpStreamer.startStream('rtmp://192.168.101.117:1935/live/test');

Listen to events:

RtmpStreamer.events.listen((event) {
  print('${event.type}: ${event.message}');
});

Stop:

await RtmpStreamer.stopStream();
await RtmpStreamer.release();

Switch camera:

await RtmpStreamer.switchCamera();

Mute:

final muted = await RtmpStreamer.toggleMute();

Screen sharing:

await RtmpStreamer.startPreviewScreen();

Android will show the MediaProjection consent dialog.

Orientation:

await RtmpStreamer.setCameraOrientation(
  RtmpOrientation.portrait,
  rotationDegrees: 90,
);

MediaMTX Test #

Publish URL:

rtmp://<host-ip>:1935/live/test

Watch URL:

http://<host-ip>:8888/live/test/

For Android Emulator:

rtmp://10.0.2.2:1935/live/test

For a physical device, use the computer LAN IP.

Native Android API #

The plugin contains the Android core under:

com.gitlad.rtmpstreamer

Main classes:

RtmpStreamingClient
StreamSettings
StreamEvent
RawFrameListener
RawFrameChunker
ScreenShareForegroundService
PreviewSurfaceHolder

Limitations #

  • Android only.
  • RTMP protocol internals are currently handled by PedroSG94 RootEncoder.
  • Raw/chunk APIs are available in the Android layer; Dart-facing raw frame streaming is not exposed yet.
  • Chunked capture returns encoded frame chunks, not muxed .flv/.mp4 files yet.
0
likes
0
points
176
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for Android RTMP streaming with camera preview, screen sharing, orientation control, raw encoded frames, and chunked capture.

Repository (GitHub)
View/report issues

Topics

#rtmp #streaming #camera #screen-share #android

License

unknown (license)

Dependencies

flutter

More

Packages that depend on rtmpstreamer

Packages that implement rtmpstreamer