From 214a522da048ae3ce8b2e35383bad9b6558d0392 Mon Sep 17 00:00:00 2001 From: Brazol Date: Fri, 2 Feb 2024 14:20:37 +0100 Subject: [PATCH] simplified screen share constraints comparison --- development.md | 6 +++--- packages/stream_video/lib/src/webrtc/rtc_manager.dart | 7 ++----- .../lib/src/webrtc/rtc_track/rtc_local_track.dart | 11 +++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/development.md b/development.md index 70499c6a2..d0b65f91d 100644 --- a/development.md +++ b/development.md @@ -31,10 +31,10 @@ - [x] Live streaming component(s) [Deven] - [x] Deeplinking - [ ] Tap to focus (flutter_webrtc) [Kanat] -- [ ] Push notifications [Maciej] +- [x] Push notifications [Maciej] - - [x] Customization of the incoming/outgoing call screens - - [x] Customizing CallKit ringing calls -- - [ ] Bug app crashes when notification button is tapped +- - [x] Bug app crashes when notification button is tapped - [x] Native packages refactor [Maciej] - - [X] Create the native projects in stream_video_flutter - - [x] Merge stream_video_flutter_background @@ -43,7 +43,7 @@ - - [x] iOS - - [x] Android - [x] Regular reconnection [Maciej,Kanat] -- [ ] Support ICE restart reconnection [Maciej,Kanat] +- [x] Support ICE restart reconnection [Maciej,Kanat] - [x] Update WebRTC version to m114 (livekit version) [Kanat] - [x] Fix analysis issues [Maciej] diff --git a/packages/stream_video/lib/src/webrtc/rtc_manager.dart b/packages/stream_video/lib/src/webrtc/rtc_manager.dart index 653d6b79c..0b4f15e97 100644 --- a/packages/stream_video/lib/src/webrtc/rtc_manager.dart +++ b/packages/stream_video/lib/src/webrtc/rtc_manager.dart @@ -715,11 +715,8 @@ extension RtcManagerTrackHelper on RtcManager { // Track found, mute/unmute it. if (track != null) { if (enabled && - track.trackType == SfuTrackType.screenShare && - constraints is ScreenShareConstraints && - (track.mediaConstraints as ScreenShareConstraints) - .useiOSBroadcastExtension != - constraints.useiOSBroadcastExtension) { + track is RtcLocalScreenShareTrack && + !track.compareScreenShareMode(constraints)) { // If existing screen share track has different broadcast extension constraints, unpublish it and create a new one. await unpublishTrack(trackId: track.trackId); diff --git a/packages/stream_video/lib/src/webrtc/rtc_track/rtc_local_track.dart b/packages/stream_video/lib/src/webrtc/rtc_track/rtc_local_track.dart index dad72947b..a63dc6e77 100644 --- a/packages/stream_video/lib/src/webrtc/rtc_track/rtc_local_track.dart +++ b/packages/stream_video/lib/src/webrtc/rtc_track/rtc_local_track.dart @@ -289,3 +289,14 @@ extension RtcLocalAudioTrackHardwareExt on RtcLocalAudioTrack { } } } + +extension RtcLocalScreenShareTrackExt on RtcLocalScreenShareTrack { + bool compareScreenShareMode(MediaConstraints? constraints) { + if (constraints !is ScreenShareConstraints) { + return false; + } + + return mediaConstraints.useiOSBroadcastExtension == + (constraints as ScreenShareConstraints).useiOSBroadcastExtension; + } +}