Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: VideoRenderer improvements for iOS. #693

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions example/lib/pages/connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ class _ConnectPageState extends State<ConnectPage> {
if (lkPlatformIs(PlatformType.android)) {
_checkPermissions();
}

if (lkPlatformIsMobile()) {
LiveKitClient.initialize(bypassVoiceProcessing: true);
}
}

@override
Expand Down
2 changes: 2 additions & 0 deletions lib/src/track/track.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ abstract class Track extends DisposableChangeNotifier

await onStopped();

await mediaStreamTrack.stop();

logger.fine('$objectId.stop()');

_active = false;
Expand Down
16 changes: 9 additions & 7 deletions lib/src/widgets/video_track_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ class _VideoTrackRendererState extends State<VideoTrackRenderer> {
late GlobalKey _internalKey;

Future<rtc.VideoRenderer> _initializeRenderer() async {
if (widget.renderMode == VideoRenderMode.platformView) {
if (lkPlatformIs(PlatformType.iOS) &&
widget.renderMode == VideoRenderMode.platformView) {
return Null as Future<rtc.VideoRenderer>;
}
_renderer ??= rtc.RTCVideoRenderer();
await _renderer!.initialize();
if (_renderer == null) {
_renderer = rtc.RTCVideoRenderer();
await _renderer!.initialize();
}
await _attach();
return _renderer!;
}
Expand Down Expand Up @@ -181,8 +184,7 @@ class _VideoTrackRendererState extends State<VideoTrackRenderer> {

Widget _videoRendererView() {
if (lkPlatformIs(PlatformType.iOS) &&
[VideoRenderMode.auto, VideoRenderMode.platformView]
.contains(widget.renderMode)) {
widget.renderMode == VideoRenderMode.platformView) {
return rtc.RTCVideoPlatFormView(
mirror: _shouldMirror(),
objectFit: widget.fit,
Expand All @@ -205,8 +207,8 @@ class _VideoTrackRendererState extends State<VideoTrackRenderer> {
future: _initializeRenderer(),
builder: (context, snapshot) {
if ((snapshot.hasData && _renderer != null) ||
[VideoRenderMode.auto, VideoRenderMode.platformView]
.contains(widget.renderMode)) {
(lkPlatformIs(PlatformType.iOS) &&
widget.renderMode == VideoRenderMode.platformView)) {
return Builder(
key: _internalKey,
builder: (ctx) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
uuid: '>=3.0.6'
synchronized: ^3.0.0+3
protobuf: ^3.0.0
flutter_webrtc: ^0.12.4
flutter_webrtc: ^0.12.7
device_info_plus: ^11.1.1
js: '>=0.6.4'
platform_detect: ^2.0.7
Expand Down
Loading