i'm using rtcdatachannel. messages i'm sending through channel not receiving @ other peer.
here code:
let audioconstraint : rtcpair = rtcpair(key: "offertoreceiveaudio", value: "true") let videoconstraint : rtcpair = rtcpair(key: "offertoreceivevideo", value: "true") let dtlsconstraint : rtcpair = rtcpair(key: "dtlssrtpkeyagreement", value: "true") let mediacontraints : rtcmediaconstraints = rtcmediaconstraints(mandatoryconstraints: [audioconstraint, videoconstraint], optionalconstraints: [ dtlsconstraint]) rtcpeerconnectionfactory.initializessl() peerconnection = peerconnectionfactory.peerconnectionwithiceservers(servers, constraints: mediacontraints, delegate: self) datachannels = peerconnection?.createdatachannelwithlabel(channelname,config: nil) datachannels?.delegate = self var message : nsdata = nsdata(base64encodedstring: "helloo") var buffer : rtcdatabuffer = rtcdatabuffer(data: message, isbinary: true) datachannels?.senddata(buffer)
have resolved it? 1 of 2 peers should create data channel , other should attach received data channel object data channel object. initiator should create datachannel before sending offer. hope might helpful
Comments
Post a Comment