From 0d6ecb3d5bafe6751859959b628bcb2917cbae2c Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 22 Jul 2024 06:21:12 +0800 Subject: [PATCH] update. --- example/lib/pages/prejoin.dart | 1 + example/lib/widgets/participant.dart | 1 + lib/src/widgets/video_track_renderer.dart | 7 +++++-- pubspec.yaml | 5 ++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/example/lib/pages/prejoin.dart b/example/lib/pages/prejoin.dart index a92aea12..402d8458 100644 --- a/example/lib/pages/prejoin.dart +++ b/example/lib/pages/prejoin.dart @@ -271,6 +271,7 @@ class _PreJoinPageState extends State { color: Colors.black54, child: _videoTrack != null ? VideoTrackRenderer( + renderMode: VideoRenderMode.auto, _videoTrack!, fit: RTCVideoViewObjectFit .RTCVideoViewObjectFitContain, diff --git a/example/lib/widgets/participant.dart b/example/lib/widgets/participant.dart index 18d03ad0..78d8ba19 100644 --- a/example/lib/widgets/participant.dart +++ b/example/lib/widgets/participant.dart @@ -142,6 +142,7 @@ abstract class _ParticipantWidgetState onTap: () => setState(() => _visible = !_visible), child: activeVideoTrack != null && !activeVideoTrack!.muted ? VideoTrackRenderer( + renderMode: VideoRenderMode.auto, activeVideoTrack!, fit: RTCVideoViewObjectFit.RTCVideoViewObjectFitContain, ) diff --git a/lib/src/widgets/video_track_renderer.dart b/lib/src/widgets/video_track_renderer.dart index 5ee88625..5cd82886 100644 --- a/lib/src/widgets/video_track_renderer.dart +++ b/lib/src/widgets/video_track_renderer.dart @@ -162,7 +162,8 @@ class _VideoTrackRendererState extends State { future: _initializeRenderer(), builder: (context, snapshot) { if ((snapshot.hasData && _renderer != null) || - widget.renderMode == VideoRenderMode.platformView) { + [VideoRenderMode.auto, VideoRenderMode.platformView] + .contains(widget.renderMode)) { return Builder( key: _internalKey, builder: (ctx) { @@ -172,13 +173,15 @@ class _VideoTrackRendererState extends State { widget.track.onVideoViewBuild?.call(_internalKey); }); if (lkPlatformIs(PlatformType.iOS) && - widget.renderMode == VideoRenderMode.platformView) { + [VideoRenderMode.auto, VideoRenderMode.platformView] + .contains(widget.renderMode)) { return rtc.RTCVideoPlatFormView( mirror: _shouldMirror(), objectFit: widget.fit, onViewReady: (controller) { _renderer = controller; _renderer?.srcObject = widget.track.mediaStream; + _attach(); }, ); } diff --git a/pubspec.yaml b/pubspec.yaml index f0efad2b..a5f3f05c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,7 +37,10 @@ dependencies: uuid: '>=3.0.6' synchronized: ^3.0.0+3 protobuf: ^3.0.0 - flutter_webrtc: ^0.11.3 + flutter_webrtc: + git: + url: https://github.com/flutter-webrtc/flutter-webrtc.git + ref: feat/platform-view-using-av-samplebuffer device_info_plus: '>=8.0.0' js: '>=0.6.4' platform_detect: ^2.0.7