@@ -2,12 +2,10 @@ import 'dart:async';
22import 'dart:convert' ;
33
44import 'package:collection/collection.dart' ;
5- import 'package:device_info_plus/device_info_plus.dart' ;
65import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart' ;
76import 'package:rxdart/rxdart.dart' ;
87import 'package:stream_webrtc_flutter/stream_webrtc_flutter.dart' as rtc;
98import 'package:synchronized/synchronized.dart' ;
10- import 'package:system_info2/system_info2.dart' ;
119
1210import '../../../globals.dart' ;
1311import '../../../protobuf/video/sfu/event/events.pb.dart' as sfu_events;
@@ -124,8 +122,6 @@ class CallSession extends Disposable {
124122 Timer ? _peerConnectionCheckTimer;
125123 bool _isLeavingOrClosed = false ;
126124
127- sfu_models.ClientDetails ? _clientDetails;
128-
129125 SharedEmitter <SfuEvent > get events => sfuWS.events;
130126
131127 late final _vvBuffer = DebounceBuffer <VisibilityChange , Result <None >>(
@@ -153,87 +149,6 @@ class CallSession extends Disposable {
153149 });
154150 }
155151
156- Future <void > _ensureClientDetails () async {
157- if (_clientDetails != null ) return ;
158-
159- try {
160- sfu_models.Device ? device;
161- sfu_models.Browser ? browser;
162-
163- var os = sfu_models.OS (
164- name: CurrentPlatform .name,
165- );
166-
167- if (CurrentPlatform .isAndroid) {
168- final deviceInfo = await DeviceInfoPlugin ().androidInfo;
169- os = sfu_models.OS (
170- name: CurrentPlatform .name,
171- version: deviceInfo.version.release,
172- architecture: SysInfo .rawKernelArchitecture,
173- );
174- device = sfu_models.Device (
175- name: '${deviceInfo .manufacturer } : ${deviceInfo .model }' ,
176- );
177- } else if (CurrentPlatform .isIos) {
178- final deviceInfo = await DeviceInfoPlugin ().iosInfo;
179- os = sfu_models.OS (
180- name: CurrentPlatform .name,
181- version: deviceInfo.systemVersion,
182- );
183- device = sfu_models.Device (
184- name: deviceInfo.utsname.machine,
185- );
186- } else if (CurrentPlatform .isWeb) {
187- final browserInfo = await DeviceInfoPlugin ().webBrowserInfo;
188- browser = sfu_models.Browser (
189- name: browserInfo.browserName.name,
190- version: browserInfo.vendorSub,
191- );
192- } else if (CurrentPlatform .isMacOS) {
193- final deviceInfo = await DeviceInfoPlugin ().macOsInfo;
194- os = sfu_models.OS (
195- name: CurrentPlatform .name,
196- version:
197- '${deviceInfo .majorVersion }.${deviceInfo .minorVersion }.${deviceInfo .patchVersion }' ,
198- architecture: deviceInfo.arch,
199- );
200- device = sfu_models.Device (
201- name: deviceInfo.model,
202- version: deviceInfo.osRelease,
203- );
204- } else if (CurrentPlatform .isWindows) {
205- final deviceInfo = await DeviceInfoPlugin ().windowsInfo;
206- os = sfu_models.OS (
207- name: CurrentPlatform .name,
208- version:
209- '${deviceInfo .majorVersion }.${deviceInfo .minorVersion }.${deviceInfo .buildNumber }' ,
210- architecture: deviceInfo.buildLabEx,
211- );
212- } else if (CurrentPlatform .isLinux) {
213- final deviceInfo = await DeviceInfoPlugin ().linuxInfo;
214- os = sfu_models.OS (
215- name: CurrentPlatform .name,
216- version: '${deviceInfo .name } ${deviceInfo .version }' ,
217- );
218- }
219-
220- final versionSplit = streamVideoVersion.split ('.' );
221- _clientDetails = sfu_models.ClientDetails (
222- sdk: sfu_models.Sdk (
223- type: sfu_models.SdkType .SDK_TYPE_FLUTTER ,
224- major: versionSplit.first,
225- minor: versionSplit.skip (1 ).first,
226- patch: versionSplit.last,
227- ),
228- os: os,
229- device: device,
230- browser: browser,
231- );
232- } catch (e) {
233- _logger.e (() => '[_ensureClientDetails] failed: $e ' );
234- }
235- }
236-
237152 Future <sfu_events.ReconnectDetails > getReconnectDetails (
238153 SfuReconnectionStrategy strategy, {
239154 String ? migratingFromSfuId,
@@ -274,8 +189,6 @@ class CallSession extends Disposable {
274189 'isAnonymousUser: $isAnonymousUser ' ,
275190 );
276191
277- await _ensureClientDetails ();
278-
279192 await _eventsSubscription? .cancel ();
280193 await _rtcManagerSubject? .close ();
281194
@@ -338,7 +251,7 @@ class CallSession extends Disposable {
338251 : clientPublishOptions? .getPreferredSubscriberOptions ();
339252
340253 final joinRequest = sfu_events.JoinRequest (
341- clientDetails: _clientDetails ,
254+ clientDetails: clientDetails ,
342255 token: config.sfuToken,
343256 sessionId: sessionId,
344257 subscriberSdp: subscriberSdp,
@@ -384,7 +297,7 @@ class CallSession extends Disposable {
384297 rtcManager =
385298 await rtcManagerFactory.makeRtcManager (
386299 sfuClient: sfuClient,
387- clientDetails: _clientDetails ,
300+ clientDetails: clientDetails ,
388301 sessionSequence: sessionSeq,
389302 statsOptions: statsOptions,
390303 )
@@ -407,7 +320,7 @@ class CallSession extends Disposable {
407320 sfuClient: sfuClient,
408321 publisherId: localTrackId,
409322 publishOptions: joinResponseEvent.publishOptions,
410- clientDetails: _clientDetails ,
323+ clientDetails: clientDetails ,
411324 sessionSequence: sessionSeq,
412325 statsOptions: statsOptions,
413326 callSessionConfig: config,
@@ -511,8 +424,6 @@ class CallSession extends Disposable {
511424 rtc.TransceiverDirection .SendOnly ,
512425 );
513426
514- await _ensureClientDetails ();
515-
516427 Result <({SfuCallState callState, Duration fastReconnectDeadline})?>?
517428 result;
518429
@@ -523,7 +434,7 @@ class CallSession extends Disposable {
523434 sfuWS.send (
524435 sfu_events.SfuRequest (
525436 joinRequest: sfu_events.JoinRequest (
526- clientDetails: _clientDetails ,
437+ clientDetails: clientDetails ,
527438 token: config.sfuToken,
528439 sessionId: sessionId,
529440 subscriberSdp: subscriberSdp,
0 commit comments