我正在准备使用webRTC进行音频通话。 我的步骤是: 1.创建报价 2.设置本地描述 3.在插座上发送报价 4.从套接字收到消息 5.创建远程描述 6.接收者加入 7.从套接字收到消息 8.设置远程描述 9.从接收方收到媒体流
,但此流未播放。
func peerConnection(_ peerConnection: RTCPeerConnection!, addedStream stream: RTCMediaStream!) {
print("--------- received media stream----------")
if (peerConnection == nil) {
return
}
if (stream.audioTracks.count > 1) {
//Log(value: "Weird-looking stream: " + stream.description)
return
}
remoteAudioTrack = stream.audioTracks[0] as? RTCAudioTrack
remoteAudioTrack.setEnabled(true)
remoteAudioTrack.setState(RTCTrackState.init(1))
localMediaStream.addAudioTrack(remoteAudioTrack)
peerConnection.add(localMediaStream)
}
我发送和接收的流是这样的: [janus:A = 1:V = 0]