Ich habe es geschafft, Video und Audio zwischen A und B zu teilen, und ich habe festgestellt, dass RTCDataChannelState in kRTCDataChannelStateOpen geändert wurde.Fehler beim Senden der Nachricht mit RTCDataChannel unter iOS
- (void)channelDidChangeState:(RTCDataChannel*)channel
sendData
auch JA zurückkehren kann, aber ich kann nicht die Nachricht empfangen und
- (void)peerConnection:(RTCPeerConnection*)peerConnection
didOpenDataChannel:(RTCDataChannel*)dataChannel
nie denken called.I es nach Eis Zustand RTCICEConnectionConnected
geändert aufgerufen werden soll aber es funktioniert nicht!
erstellen Datenkanal:
RTCDataChannelInit *DataChannelInit = [[RTCDataChannelInit alloc] init];
DataChannelInit.maxRetransmits = 0;
DataChannelInit.isOrdered=false;
DataChannelInit.maxRetransmitTimeMs = -1;
DataChannelInit.isNegotiated = false;
DataChannelInit.streamId = 25;
RTCDataChannel *dataChannel =[_peerConnection createDataChannelWithLabel:@"commands" config:DataChannelInit];
dataChannel.delegate=self;
self.datachannel = dataChannel;
Mein Angebot und anwser:
- (RTCMediaConstraints *)defaultOfferConstraints {
NSArray *mandatoryConstraints = @[
[[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"],
[[RTCPair alloc] initWithKey:@"OfferToReceiveVideo" value:@"true"]
];
NSArray *optionalConstraints = @[
[[RTCPair alloc] initWithKey:@"internalSctpDataChannels" value:@"true"],
[[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"]
];
RTCMediaConstraints *constraints =
[[RTCMediaConstraints alloc]
initWithMandatoryConstraints:mandatoryConstraints
optionalConstraints:optionalConstraints];
return constraints;
}
Ich erstelle das Angebot nach dem Erstellen von Datenkanal, aber 'didOpenDataChannel' wurde nicht aufgerufen, nachdem ich die RemoteDescription eingestellt habe. – potato
Können Sie das Angebot sdp mit Pastebin bieten? – Ajay
Vielen Dank für Ihre Hilfe und hier ist mein [Angebot sdp] (https://pastebin.com/embed_js/iY9h0SVS) – potato