8000 I am using streaming as broadcast and my ios apk is getting crash when i call setLocalDescription multiple time.I have overcome this issue by adding null check.please refer below code and expecting this change in next update if possible.Thanks in advance. . · Issue #513 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content

I am using streaming as broadcast and my ios apk is getting crash when i call setLocalDescription multiple time.I have overcome this issue by adding null check.please refer below code and expecting this change in next update if possible.Thanks in advance. . #513

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

Closed
ShilpaVania opened this issue Mar 31, 2021 · 0 comments

Comments

@ShilpaVania
Copy link

Getting below Error when i tried to call setLocalDescription multiple time within single stream.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:

Solution i had applied:
FileName: FlutterWebRTCPlugin.m
Added if(sender == nil) return;

if ([@"addTrack" isEqualToString:call.method]){
        NSDictionary* argsMap = call.arguments;
        NSString* peerConnectionId = argsMap[@"peerConnectionId"];
        NSString* trackId = argsMap[@"trackId"];
        NSArray* streamIds = argsMap[@"streamIds"];
        RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
        if(peerConnection == nil) {
            result([FlutterError errorWithCode:[NSString stringWithFormat:@"%@Failed",call.method]
            message:[NSString stringWithFormat:@"Error: peerConnection not found!"]
            details:nil]);
            return;
        }
        
        RTCMediaStreamTrack *track = [self trackForId:trackId];
        if(track == nil) {
            result([FlutterError errorWithCode:[NSString stringWithFormat:@"%@Failed",call.method]
            message:[NSString stringWithFormat:@"Error: track not found!"]
            details:nil]);
            return;
        }
        RTCRtpSender* sender = [peerConnection addTrack:track streamIds:streamIds];
        NSLog(@"addtrack: %@", sender);
        if(sender == nil) return;
        result([self rtpSenderToMap:sender]);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0