flutter_rtc_link 0.1.2
flutter_rtc_link: ^0.1.2 copied to clipboard
Flutter plugin for real-time audio/video (WebRTC WHIP/WHEP + LiveKit) and IoT device management: publish, subscribe, live relay, robot teleoperation, provisioning and OTA.
Changelog #
0.1.2 #
Fixed / 修复 #
- Example app device-page action row overflow on narrow screens: the SCAN BLE / DPP / NFC buttons were laid out in a fixed three-up
Rowthat overflowed; they now wrap so they flow to the next line when space is tight.- 示例应用设备页操作行在窄屏溢出:SCAN BLE / DPP / NFC 原本排成固定三列
Row会溢出;现已改为自动换行。
- 示例应用设备页操作行在窄屏溢出:SCAN BLE / DPP / NFC 原本排成固定三列
- Lowered the
permission_handlerconstraint to^11.0.0so its Android submodule stays at API ≤ 36, keeping the default Flutter template (AGP 9.1.0 / compileSdk 36) buildable without forcing an AGP / Gradle upgrade.- 将
permission_handler约束降到^11.0.0,使其 Android 子模块停留在 API ≤ 36,从而默认 Flutter 模板(AGP 9.1.0 / compileSdk 36)无需升级 AGP / Gradle 即可构建。
- 将
0.1.1 #
Fixed / 修复 #
- Joystick crash on first release:
_animationwas declaredlate finalbut reassigned in_release(), throwingLateInitializationError. It is now a reassignablelatefield.- 摇杆首次松手崩溃:
_animation被声明为late final却在_release()中二次赋值,抛LateInitializationError;现改为可重新赋值的late字段。
- 摇杆首次松手崩溃:
- LiveKit multi-stream subscription revocation: subscribing a second stream overwrote the track-subscription allowlist and revoked the first. Wanted track SIDs are now accumulated per participant and re-granted together.
- LiveKit 多路订阅互相撤销:订阅第二路时覆盖轨道订阅白名单、撤销第一路;现按参与者累加想要的轨道 SID 并统一重新授权。
- ResilientSession re-entrant reconnect double scheduling: the
_recoveringguard was set afterawait pause(), letting two racing events both schedule a backoff timer. The guard is now taken synchronously before the await.- ResilientSession 重入重连双调度:
_recovering守卫在await pause()之后才置位,两类并发事件可同时穿过并各调度一个退避定时器;现改为在 await 前同步加锁。
- ResilientSession 重入重连双调度:
- ResilientSession never emitted
RtcConnected: the session's ownRtcConnectedwas suppressed in_onSessionEventbut never re-emitted byResilientSession, so consumers never learned a link was (re)established. It is now emitted from_establish.- ResilientSession 从不对外发出
RtcConnected:会话自身的RtcConnected在_onSessionEvent中被抑制,而ResilientSession又从未补发,导致消费者永远收不到连接成功事件;现由_establish补发。
- ResilientSession 从不对外发出
setBackground(false)duplicate resume: whenautoResumeAfterReconnectis enabled,_afterReconnectalready resumed the gate, yet the foreground path requested a second (orphaned) resume ticket. The foreground path now skips resume in that case.setBackground(false)重复恢复:开启autoResumeAfterReconnect时_afterReconnect已处理门的恢复,回到前台又发起一个被废弃的恢复票据;现已在该情况下跳过。
- LanDiscovery.discoverStream early-cancel crash:
onCanceltouchedlatediscovery/listener fields that were not yet initialized if the stream was cancelled beforestartDiscoveryresolved, throwingLateInitializationError. They are now nullable with null checks.- LanDiscovery.discoverStream 提前取消崩溃:
onCancel访问尚未初始化的late字段(流在startDiscovery完成前被取消时),抛LateInitializationError;现改为可空并加空判断。
- LanDiscovery.discoverStream 提前取消崩溃:
0.1.0 #
Added / 新增 #
- Initial release of
flutter_rtc_link: a Flutter plugin for real-time audio/video and IoT device management with a dual-engine architecture (WhipWhepEngineoverflutter_webrtc,LiveKitEngineoverlivekit_client) behind one unified abstraction (RtcEngine/RtcSession/LocalPublisher/RemoteSubscriber).flutter_rtc_link首个版本:实时音视频 + 物联网设备管理插件,双引擎架构(基于flutter_webrtc的WhipWhepEngine与基于livekit_client的LiveKitEngine)统一抽象(RtcEngine/RtcSession/LocalPublisher/RemoteSubscriber)。
- Lead-operator publishing with simulcast:
startCamera/startMic/startScreenShare, zero-renegotiationswitchCameraviareplaceTrack(RFC 9725 friendly), andsetPublishClaritythat caps the top simulcast layer.- 牵头操作者推流(simulcast 多层):
startCamera/startMic/startScreenShare、经replaceTrack的零重协商switchCamera(符合 RFC 9725),以及只限制最高层的setPublishClarity。
- 牵头操作者推流(simulcast 多层):
- Subscription and picture switching: WHEP playback, per-stream
RemoteSubscriber.setClarity, and a pure-DartVideoGridController(main/pip/grid layouts, max visible, global clarity).- 订阅与画面切换:WHEP 拉流、每路独立的
RemoteSubscriber.setClarity,以及纯 Dart 的VideoGridController(主画面 / 画中画 / 网格布局、最大可见数、全局清晰度)。
- 订阅与画面切换:WHEP 拉流、每路独立的
- Live relay:
RoleTransfer.promote/handover(identity handover) andStreamRelay.toRtmp/cascade(server-side Egress or secondary WHIP push).- 直播转接:
RoleTransfer.promote/handover(身份交接)与StreamRelay.toRtmp/cascade(服务端 Egress 或二次 WHIP 推流)。
- 直播转接:
- Robot teleoperation:
RobotControllerwith joystick velocity integration, PTZ, telemetry, voice intercom hookup, and a 500 ms watchdog that auto-stops the robot on command timeout or link loss.- 机器人远控:
RobotController支持摇杆速度积分、云台 PTZ、遥测、语音对讲接入,以及指令超时 / 断链 500ms 内自动停车的看门狗保护。
- 机器人远控:
- IoT device management suite: multi-channel
DeviceProvisioning(BLE → DPP/QR → NFC → SoftAP → SmartConfig strategy chain with automatic degradation),OtaUpdater(BLE/HTTP with SHA-256 verification),DeviceLogCollector(local cache + batch upload), andDiagnostics(WebRTC stats + network probe + device logs → JSON/Markdown report).- 物联网设备管理四件套:多通道
DeviceProvisioning(BLE → DPP/QR → NFC → SoftAP → SmartConfig 策略链,失败自动降级)、OtaUpdater(BLE/HTTP,SHA-256 校验)、DeviceLogCollector(本地缓存 + 批量补传)、Diagnostics(WebRTC stats + 网络探测 + 设备日志 → JSON/Markdown 报告)。
- 物联网设备管理四件套:多通道
- Unified permission gate
RtcPermissions.requestAll(capabilities)covering the Android 13/14+ and iOS pitfalls (foreground-service microphone, nearby Wi-Fi devices, NFC entitlement); denials degrade features and emitRtcEvent.permissionDeniedinstead of crashing.- 统一权限入口
RtcPermissions.requestAll(capabilities),覆盖 Android 13/14+ 与 iOS 的权限坑(前台服务麦克风、附近 Wi-Fi 设备、NFC entitlement);权限被拒时功能降级并上报RtcEvent.permissionDenied,不崩溃。
- 统一权限入口
- Native modules: Android DPP (Wi-Fi Easy Connect) platform channel and a microphone foreground service; iOS Swift method-channel stub. Method channel prefix
pkg.flutter.dev/rtc_link/with centralizedRtcErrorCodes.- 原生模块:Android DPP(Wi-Fi Easy Connect)平台通道与麦克风前台服务;iOS Swift method channel 桩。Method channel 前缀
pkg.flutter.dev/rtc_link/,错误码集中定义于RtcErrorCodes。
- 原生模块:Android DPP(Wi-Fi Easy Connect)平台通道与麦克风前台服务;iOS Swift method channel 桩。Method channel 前缀
- Ready-to-run example app (publish/subscribe, robot joystick, device management demos) and unit tests for the layout, clarity, relay, watchdog, provisioning, log-cache and diagnostics paths.
- 可直接运行的 example 应用(推流 / 订阅、机器人摇杆、设备管理演示)以及布局、清晰度、转接、看门狗、配网、日志缓存与诊断路径的单元测试。
- Resilience layer for overseas / cross-public-network links:
ResilientSession(supervised connect, jittered backoff reconnect with automatic re-subscription),RelayPlanner(per-region TURN ordering +RelayMode.forcedescalation for CGNAT / cross-border paths),NetworkPathMonitor(Wi-Fi ↔ cellular handover → ICE restart) andMediaHealthMonitor(stutter / congestion / frozen-picture detection with keyframe → downgrade → re-subscribe recovery).- 面向海外 / 跨公网链路的韧性层:
ResilientSession(受控建链、带抖动退避重连并自动重新订阅)、RelayPlanner(按区域排序 TURN + 面向 CGNAT / 跨境路径的RelayMode.forced升级)、NetworkPathMonitor(Wi-Fi ↔ 蜂窝切换触发 ICE 重启)与MediaHealthMonitor(卡顿 / 拥塞 / 画面冻结检测,并按请求关键帧 → 降档 → 重建订阅逐级恢复)。
- 面向海外 / 跨公网链路的韧性层:
- App-side pause/resume confirmation flow:
PauseResumeGatestamps every operation with an epoch; pausing bumps the epoch so buffered operations are dropped instead of replayed, and resuming is a two-step ticket handshake (requestResume→confirmResume) that expires.EpochOperationQueueadds latest-wins buffering for teleoperation.- 应用侧暂停 / 恢复确认流程:
PauseResumeGate为每个操作盖上 epoch 戳;暂停会递增 epoch,使缓存操作被丢弃而非补发;恢复是一次会过期的两步票据握手(requestResume→confirmResume)。EpochOperationQueue为遥控提供"最新者胜"缓冲。
- 应用侧暂停 / 恢复确认流程:
- Low-latency control link helpers:
ControlLinkRouter(data channel preferred, MQTT fallback, latency budget),ControlRttTrackerandCommandRateLimiter.- 低时延控制链路辅助:
ControlLinkRouter(优先数据通道、回退 MQTT、带时延预算)、ControlRttTracker与CommandRateLimiter。
- 低时延控制链路辅助:
AppLifecycleGate: maps Flutter lifecycle states (paused/hidden/detached) to background suspension and drives the pause/resume gate.AppLifecycleGate:把 Flutter 生命周期状态(paused/hidden/detached)映射为后台暂停,并驱动暂停 / 恢复门。
Changed / 变更 #
RobotControlleraccepts an optionalPauseResumeGateandCommandRateLimiter;pause()stops the robot immediately and invalidates every command issued before it, and the keepalive loop never replays a pre-pause velocity.RobotController可接收可选的PauseResumeGate与CommandRateLimiter;pause()立即停车并让此前所有指令失效,保活循环绝不补发暂停前的速度。
WhipWhepSessionimplementsIceRestartable: handover now rebuilds the peer connections with a fresh ICE configuration (WHIP/WHEP forbids renegotiation, RFC 9725).WhipWhepSession实现了IceRestartable:切换时会用全新的 ICE 配置重建 peer connection(RFC 9725 规定 WHIP/WHEP 不可重协商)。