rtmp_streaming 1.0.5 copy "rtmp_streaming: ^1.0.5" to clipboard
rtmp_streaming: ^1.0.5 copied to clipboard

A Flutter plugin for Camera and Microphone streaming library via RTMP.

rtmp_stream #

πŸ“– Overview #

rtmp_stream is a Flutter plugin designed to provide unified RTMP streaming and video recording capabilities for Android and iOS.
It addresses the lack of suitable Flutter RTMP plugins on pub.dev: existing plugins are either no longer maintained or rely on outdated dependencies, making them unsuitable for modern mobile applications.


βš™οΈ Technical Foundation #

By leveraging these mature libraries, rtmp_stream provides a consistent cross-platform API interface, reducing development complexity.


❓ Why This Plugin #

  • No suitable Flutter RTMP plugin exists on pub.dev.
  • Existing plugins suffer from:
    • Long-term lack of maintenance.
    • Outdated dependencies, incompatible with the latest Flutter and platform SDKs.

Therefore, the goal of rtmp_stream is to deliver a modern, stable, and maintainable RTMP streaming solution.


πŸ› οΈ Supported Methods #

🌍 Common Methods (Android & iOS) #

  • πŸ“· Get available cameras: availableCameras
  • βš™οΈ Initialize plugin: initialize
  • πŸŽ₯ Start local video recording: startVideoRecording
  • ⏹️ Stop local video recording: stopRecording
  • πŸ“‘ Start recording and streaming: startVideoRecordingAndStreaming
  • ⏹️ Stop recording or streaming: stopRecordingOrStreaming
  • πŸ“‘ Start video streaming: startVideoStreaming
  • ⏹️ Stop video streaming: stopStreaming
  • πŸ”„ Switch camera: switchCamera
  • πŸ”Š Toggle audio on/off: switchAudio
  • πŸ’‘ Toggle flashlight on/off: switchFlashLight
  • πŸ“Š Get stream statistics: getStreamStatistics
  • πŸ—‘οΈ Dispose plugin: dispose
  • πŸ“Έ Take snapshot during streaming: takePicture

🍎 iOS Exclusive Methods #

Since HaishinKit supports not only streaming but also RTMP playback, iOS provides additional features:

  • ⏸️ Pause stream playback: pauseStream

    Note: This pauses playback, not streaming.

  • ▢️ Resume stream playback: resumeStream

    Note: This resumes playback, not streaming.

  • 🎚️ Set audio bitrate: setAudioSettings
  • 🎞️ Set video settings: setVideoSettings (optional expectedFrameRate, bitRateMode β€” HaishinKit 2.2.1+ / 2.2.2+)
  • πŸ“± Multitasking camera access: setMultitaskingCameraAccessEnabled (HaishinKit 2.2.5+, iOS 17+ when supported)
  • πŸ”Š Get temporary mute status: getHasAudio
  • πŸ”Š Set temporary mute: setHasAudio
  • πŸŽ₯ Get temporary video stop status: getHasVideo
  • πŸŽ₯ Set temporary video stop: setHasVideo
  • 🎬 Set streaming frame rate: setFrameRate
  • βš™οΈ Set session preset: setSessionPreset
  • πŸ–ΌοΈ Set screen dimensions: setScreenSettings

πŸ€– Android Exclusive Methods #

Android provides additional features during live streaming:

  • ⏸️ Pause recording: pauseVideoRecording
  • ▢️ Resume recording: resumeVideoRecording
  • 🎨 Apply filter: setFilter

    Filter type values correspond to filters defined in source code:
    CameraNativeView.kt

  • ❌ Remove filter: removeFilter
  • 🎨 BT.709 encoding hint: setForceBt709Color (RootEncoder 2.7.0+)
  • πŸ“Ά RTMP ping / RTT: setRtmpShouldSendPings (RootEncoder 2.7.0+)

πŸ“˜ Extended API usage (platform-specific) #

Android: setForceBt709Color(bool enabled) #

  • What it does: Tells the video encoder to use a BT.709 color matrix for encoded video, which can align colors with players or servers that expect BT.709 for HD content.
  • When to call: After initialize, before starting recording or streaming (or before the next prepare path). The plugin applies the flag when preparing video for record/stream.
  • Example:
await controller.setForceBt709Color(true);
await controller.startVideoStreaming(url);

Android: setRtmpShouldSendPings(bool enabled) #

  • What it does: Enables RTMP ping commands so the server can respond with pong; the client can derive round-trip time (RTT).
  • When to call: After initialize, before startVideoStreaming (or combined record+stream). Must be set before connect.
  • Related: Use getStreamStatistics() while streaming; when pings are enabled and the server supports them, the map includes rttMicros (microseconds) and bytesSend (where supported).
  • Example:
await controller.setRtmpShouldSendPings(true);
await controller.startVideoStreaming(url);
// later, while streaming:
final stats = await controller.getStreamStatistics();
// stats.rttMicros, stats.bytesSend, ...

iOS: setVideoSettings({ ... }) #

Existing parameters: bitrate, width, height, frameInterval, profileLevel (iOS only).

HaishinKit 2.2.1+ / 2.2.2+ extensions (optional named parameters):

Parameter Type Meaning
expectedFrameRate double? Encoder hint; also appears in RTMP onMetaData as framerate (2.2.2+).
bitRateMode String? "average" (default behavior), "constant" (iOS 16+), "variable" (iOS 26+ / VideoToolbox VBR).
  • When to call: After initialize, typically before or early during streaming; follow HaishinKit guidance for changing settings while live.
  • Example:
await controller.setVideoSettings(
  expectedFrameRate: 30,
  bitRateMode: 'average',
);

iOS: setMultitaskingCameraAccessEnabled(bool enabled) #

  • What it does: When supported, sets AVCaptureSession.isMultitaskingCameraAccessEnabled so capture can continue in multitasking / split-screen / PiP-style scenarios (HaishinKit 2.2.5+).
  • Requirements: iOS 17+ for the underlying configuration API; device must report isMultitaskingCameraAccessSupported.
  • When to call: After initialize, before starting streaming (same session as preview).
  • Example:
await controller.setMultitaskingCameraAccessEnabled(true);
await controller.startVideoStreaming(url);

πŸš€ Conclusion #

rtmp_stream provides Flutter developers with a cross-platform, modern RTMP streaming and video recording plugin, addressing the shortcomings of the current ecosystem.
It is built on Android’s RootEncoder and iOS’s HaishinKit, offering a unified API while extending playback and audio/video controls on iOS, and snapshot and filter features on Androidβ€”helping developers quickly build live streaming and recording applications.

6
likes
155
points
185
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for Camera and Microphone streaming library via RTMP.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on rtmp_streaming

Packages that implement rtmp_streaming