quickrtc_flutter_client library
QuickRTC Flutter Client Library
A Flutter WebRTC client library built on MediaSoup for real-time video conferencing.
Quick Start (Controller-Based API)
import 'package:quickrtc_flutter_client/quickrtc_flutter_client.dart';
import 'package:socket_io_client/socket_io_client.dart' as io;
// Create socket and controller
final socket = io.io('https://your-server.com');
final controller = QuickRTCController(socket: socket);
// Wrap your app with QuickRTCProvider
QuickRTCProvider(
controller: controller,
child: MyApp(),
)
// Use QuickRTCBuilder to react to state changes
QuickRTCBuilder(
buildWhen: (prev, curr) => prev.participants != curr.participants,
builder: (context, state) {
return ParticipantGrid(participants: state.participantList);
},
)
// Join and produce media (high-level API)
await controller.joinMeeting(conferenceId: 'room-123', participantName: 'Alice');
await controller.enableMedia(); // Enables camera and microphone
// Or use low-level API for more control
final media = await QuickRTCStatic.getLocalMedia(MediaConfig.audioVideo());
await controller.produce(ProduceInput.fromTracksWithTypes(media.tracksWithTypes));
// Control media
await controller.toggleCamera();
await controller.toggleMicrophone();
await controller.startScreenShare();
// Leave
await controller.leaveMeeting();
Classes
- AndroidAudioConfiguration
- AndroidNativeAudioManagement
- AppleAudioConfiguration
- AppleNativeAudioManagement
- AudioConfig
- Audio configuration
- AudioControl
- AudioOutputOptions
- An object that configures what device(s) may be offered in the user prompt.
- AudioStreamEntry
- Entry for audio stream in QuickRTCAudioGroup
- CameraUtils
- ConnectedEvent
- Connected event data
- ConsumerInfo
- Internal consumer info
- ConsumerParamsData
- Consumer parameters from server
- CustomPosition
- Custom position for fine-grained control
- DataPacketCryptor
- DataPacketCryptorFactory
- DesktopCapturer
- DesktopCapturerSource
- DisconnectedEvent
- Disconnected event data
- EncryptedPacket
- ErrorEvent
- Error event data
- FrameCryptor
- Frame encryption/decryption.
- FrameCryptorFactory
- Factory for creating frame Cryptors. For End 2 End Encryption, you need to create a KeyProvider for each peer. And set your key in keyProvider.
- Helper
- HttpClientAdapter
-
Adapter responsible for establishing the underlying WebSocket connection
used by the
websockettransport. - JoinConfig
- Configuration for joining a conference
- KeyProvider
- Shared secret key for frame encryption.
- KeyProviderOptions
- LocalMedia
- Result from getLocalMedia containing streams and tracks
- LocalStream
- Local stream handle returned from produce()
- LocalStreamEndedEvent
- Local stream ended event (e.g., user clicked browser's "Stop sharing" button)
- MediaConfig
- Configuration for getLocalMedia
- MediaDeviceInfo
- This describe the media input and output devices, such as microphones, cameras, headsets, and so forth.
- MediaDevices
- MediaRecorder
- MediaStream
- https://w3c.github.io/mediacapture-main/#mediastream
- MediaStreamConstraints
- MediaStreamTrack
- MediaTrackSupportedConstraints
- MediaTrackSupportedConstraints represents the list of constraints controlling the capabilities of a MediaStreamTrack.
- NativeAudioManagement
- NativeVideoPlayerViewState
- NewParticipantEvent
- New participant event data Streams array may be empty if participant hasn't started sharing media yet
- NewProducerData
- OptionBuilder
- Option Builder to help developer to construct an options map.
- ParserOptions
- Parser options
- Participant
- Participant information
- ParticipantInfoData
- Participant info from server
- ParticipantJoinedData
- ParticipantLeftData
- ParticipantLeftEvent
- Participant left event data
- ProduceInput
- Input for produce() - can be single track, array of tracks, or tracks with types Use the factory methods for convenience
- ProducerClosedData
- ProducerInfo
- Internal producer info
- QuickRTCAudioGroup
- A widget that combines multiple audio streams into one managed group
- QuickRTCAudioRenderer
- Dedicated audio stream renderer
- QuickRTCAudioRenderers
- Helper widget to render all audio streams from participants
- QuickRTCBuilder
- A widget that rebuilds when the QuickRTCState changes.
- QuickRTCConfig
- Configuration for QuickRTC client instance
- QuickRTCConsumer
- A comprehensive wrapper widget that combines Provider, Listener, and Builder.
- QuickRTCConsumerLite
- A simpler consumer that doesn't include a Provider.
- QuickRTCController
- QuickRTCController - Main controller for WebRTC conferencing
- QuickRTCListener
- A widget that invokes a callback in response to QuickRTCState changes.
- QuickRTCMediaRenderer
- All-in-one media renderer widget with customizable overlays
- QuickRTCMediaRendererState
- State data exposed by the renderer
- QuickRTCPlatform
- Platform-specific screen capture service handler.
- QuickRTCProvider
- Provides a QuickRTCController instance to the widget tree.
- QuickRTCState
- Immutable state for QuickRTC
- QuickRTCStatic
- Static utility methods for QuickRTC
- QuickRTCTheme
- InheritedWidget to provide QuickRTCThemeData to the widget tree
- QuickRTCThemeData
- Theme data for QuickRTC widgets
- RemoteParticipant
- Remote participant with their streams
- RemoteStream
- Remote stream from a participant
- RTCDataChannel
- RTCDataChannelInit
- RTCDataChannelMessage
- A class that represents a datachannel message. Can either contain binary data as a Uint8List or text data as a String.
- RTCDTMFSender
- RTCFactory
- RTCFactoryNative
- RTCHeaderExtension
- RTCIceCandidate
- RTCPeerConnection
- RTCRTCPParameters
- RTCRtpCapabilities
- RTCRTPCodec
- RTCRtpCodecCapability
- RTCRtpEncoding
- RTCRtpHeaderExtensionCapability
- RTCRtpParameters
- RTCRtpReceiver
- RTCRtpSender
- RTCRtpTransceiver
- RTCRtpTransceiverInit
- RTCSessionDescription
- RTCTrackEvent
- RTCVideoPlatFormView
- RTCVideoPlatformViewController
- RTCVideoRenderer
- RTCVideoRendererWidget
- Widget for rendering RTC video streams
- RTCVideoValue
- RTCVideoView
- ScreenSelectDialog
- A dialog for selecting a screen to share.
- Screen share configuration
- Socket
-
Socketconstructor. - StatsReport
- StreamPausedEvent
- Stream paused event (remote participant muted audio/video)
- StreamRemovedEvent
- Stream removed event data
- StreamResumedEvent
- Stream resumed event (remote participant unmuted audio/video)
- ThumbnailSize
- TrackWithType
- Track with optional type hint for producing
- TransportOptionsData
- Transport options from server
- VideoConfig
- Video configuration
- VideoRenderer
- WebRTC
Enums
- AdapterType
- Algorithm
- Built-in Algorithm.
- AndroidAudioAttributesContentType
- AndroidAudioAttributesUsageType
- AndroidAudioFocusMode
- AndroidAudioMode
- AndroidAudioStreamType
- AppleAudioCategory
- AppleAudioCategoryOption
- AppleAudioIOMode
- AppleAudioMode
- CameraExposureMode
- CameraFocusMode
- ConnectionStatus
- Connection status for QuickRTC
- FrameCryptorState
- KeyDerivationAlgorithm
- MediaType
- Media types for getLocalMedia
- MessageType
- RTCDataChannelMessage type
- MicrophoneMuteMode
- Strategy used by the AVAudioEngine-based audio device module to mute microphone input. iOS/macOS only.
- OverlayPosition
- Position options for overlay elements
- RecorderAudioChannel
- RTCDataChannelState
- RTCDegradationPreference
- RTCIceConnectionState
- RTCIceGatheringState
- RTCPeerConnectionState
- RTCPriorityType
-
Priority levels for RTP encoding, matching WebRTC's RTCPriorityType.
Used for both
priorityandnetworkPriorityin RTCRtpEncodingParameters. - RTCRtpMediaType
- RTCSignalingState
- RTCVideoViewObjectFit
- SourceType
- StreamType
- Stream types
- TransceiverDirection
Extensions
- AndroidAudioAttributesContentTypeEnumEx on String
- AndroidAudioAttributesUsageTypeEnumEx on String
- AndroidAudioFocusModeEnumEx on String
- AndroidAudioModeEnumEx on String
- AndroidAudioStreamTypeEnumEx on String
- AppleAudioCategoryEnumEx on String
- AppleAudioCategoryOptionEnumEx on String
- AppleAudioModeEnumEx on String
- DartySocket on Socket
- Default event listeners for dart way API.
- MediaTypeExtension on MediaType
- Extension for MediaType
- StreamTypeExtension on StreamType
- Extension to convert StreamType to/from string
- VideoRendererExtension on RTCVideoRenderer
Constants
-
reservedEvents
→ const Map<
String, int>
Properties
-
cache
→ Map<
String, dynamic> -
final
- dataPacketCryptorFactory → DataPacketCryptorFactory
-
no setter
- desktopCapturer → DesktopCapturer
-
no setter
-
desktopSourceTypeToString
→ Map<
SourceType, String> -
final
- frameCryptorFactory → FrameCryptorFactory
-
no setter
- mediaDevices → MediaDevices
-
no setter
-
no setter
- protocol → int
-
final
-
tringToDesktopSourceType
→ Map<
String, SourceType> -
final
-
typeRTCDegradationPreferenceString
→ Map<
RTCDegradationPreference, String> -
final
-
typeRTCPriorityTypeString
→ Map<
RTCPriorityType, String> -
final
-
typeRTCRtpMediaTypetoString
→ Map<
RTCRtpMediaType, String> -
final
-
typeRtpTransceiverDirectionToString
→ Map<
TransceiverDirection, String> -
final
-
typeStringToRTCPriorityType
→ Map<
String, RTCPriorityType> -
final
-
typeStringToRTCRtpMediaType
→ Map<
String, RTCRtpMediaType> -
final
-
typeStringToRtpTransceiverDirection
→ Map<
String, TransceiverDirection> -
final
Functions
-
createLocalMediaStream(
String label) → Future< MediaStream> -
createPeerConnection(
Map< String, dynamic> configuration, [Map<String, dynamic> constraints = const {}]) → Future<RTCPeerConnection> -
degradationPreferenceforString(
String? degradation) → RTCDegradationPreference -
getRtpReceiverCapabilities(
String kind) → Future< RTCRtpCapabilities> -
getRtpSenderCapabilities(
String kind) → Future< RTCRtpCapabilities> -
iceConnectionStateForString(
String? state) → RTCIceConnectionState -
iceGatheringStateforString(
String? state) → RTCIceGatheringState -
io(
dynamic uri, [dynamic opts]) → Socket -
Looks up an existing
Managerfor multiplexing. If the user summons: -
listToRtpEncodings(
List< Map< list) → List<String, dynamic> >RTCRtpEncoding> -
mediaRecorder(
) → MediaRecorder -
peerConnectionStateForString(
String? state) → RTCPeerConnectionState -
rtcDataChannelStateForString(
String state) → RTCDataChannelState -
rtcPriorityTypeForString(
String? priority) → RTCPriorityType? -
signalingStateForString(
String? state) → RTCSignalingState
Typedefs
- QuickRTCBuildWhen = bool Function(QuickRTCState previous, QuickRTCState current)
-
Signature for the
buildWhenfunction which takes the previous and current QuickRTCState and returns a boolean indicating whether the builder should be called. - QuickRTCConsumerWidgetBuilder = Widget Function(BuildContext context, QuickRTCState state, QuickRTCController controller)
- Signature for the consumer builder - receives context, state, AND controller
- QuickRTCConsumerWidgetListener = void Function(BuildContext context, QuickRTCController controller)
- Signature for consumer listener - receives context and controller
- QuickRTCErrorBuilder = Widget Function(BuildContext context, String error)
-
Signature for the
onErrorbuilder which takes the BuildContext and error message and returns a widget. - QuickRTCListenWhen = bool Function(QuickRTCState previous, QuickRTCState current)
-
Signature for the
listenWhenfunction which takes the previous and current QuickRTCState and returns a boolean indicating whether the listener should be called. - QuickRTCWidgetBuilder = Widget Function(BuildContext context, QuickRTCState state)
-
Signature for the
builderfunction which takes the BuildContext and QuickRTCState and returns a widget. - QuickRTCWidgetListener = void Function(BuildContext context, QuickRTCController controller)
-
Signature for the
listenerfunction which takes the BuildContext and QuickRTCController. - StreamAddedEvent = RemoteStream
- Stream added event (for existing participants who start new media)
- StreamTrackCallback = dynamic Function()
-
WebSocketConnector
= Future<
WebSocket> Function(Uri uri, {Map<String, String> ? headers, Iterable<String> ? protocols}) - Factory function to create a WebSocket connection. Allows consumers to provide custom WebSocket implementations (e.g., CupertinoWebSocket, OkHttpWebSocket).
Exceptions / Errors
- ScreenCapturePermissionException
- Exception thrown when screen capture permission is not granted