File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -359,13 +359,17 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
359
359
NSDictionary * argsMap = call.arguments ;
360
360
NSString * streamId = argsMap[@" streamId" ];
361
361
RTCMediaStream *stream = self.localStreams [streamId];
362
+ BOOL shouldCallResult = YES ;
362
363
if (stream) {
363
364
for (RTCVideoTrack *track in stream.videoTracks ) {
364
365
[self .localTracks removeObjectForKey: track.trackId];
365
366
RTCVideoTrack *videoTrack = (RTCVideoTrack *)track;
366
367
RTCVideoSource *source = videoTrack.source ;
367
368
if (source){
368
- [self .videoCapturer stopCapture ];
369
+ shouldCallResult = NO ;
370
+ [self .videoCapturer stopCaptureWithCompletionHandler: ^{
371
+ result (nil );
372
+ }];
369
373
self.videoCapturer = nil ;
370
374
}
371
375
}
@@ -374,7 +378,10 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
374
378
}
375
379
[self .localStreams removeObjectForKey: streamId];
376
380
}
377
- result (nil );
381
+ if (shouldCallResult) {
382
+ // do not call if will be called in stopCapturer above.
383
+ result (nil );
384
+ }
378
385
} else if ([@" mediaStreamTrackSetEnable" isEqualToString: call.method]){
379
386
NSDictionary * argsMap = call.arguments ;
380
387
NSString * trackId = argsMap[@" trackId" ];
You can’t perform that action at this time.
0 commit comments