WebRTC iOS:iOS 客户端不显示远程视频 [英] WebRTC iOS: remote video is not shown in iOS client
问题描述
我正在尝试使用 GoogleWebRTC pod 在 iOS 应用程序中实现 WebRTC.我可以在 iOS 应用程序和网络客户端之间进行视频通话,在这种情况下,音频/视频工作正常.但是,当我在两个 iOS 设备之间进行视频通话时,没有视频(音频有效).我已经检查过是否有远程流,并且有.
I am trying to implement WebRTC in an iOS application using GoogleWebRTC pod. i can place a video call between iOS app and a web client, in which case the audio/video works just fine. however when i place a video call between two iOS devices there is no video(audio works). i've checked if there is remote stream and there is.
let localStream = connectionFactory?.mediaStream(withStreamId: "StreamID")
let audioTrack = connectionFactory?.audioTrack(withTrackId: "AudioTrackID")
let videoSource = connectionFactory?.avFoundationVideoSource(with: mediaConstraint)
let videoTrack = connectionFactory?.videoTrack(with: videoSource!, trackId: "VideoTrackID")
localStream?.addAudioTrack(audioTrack!)
localStream?.addVideoTrack(videoTrack!)
peerConnection?.add(localStream!)
推荐答案
发现问题.在创建流和视频轨道时,我给出了一个硬编码字符串作为 id.当本地和远程流建立连接时,它变得相同.提供唯一字符串作为 id 可以解决问题.
Found the problem. I was giving a hard coded string as id when creating stream and video track. which when a connection is established becomes the same for both local and remote streams. providing unique strings as ids solves the problem.
这篇关于WebRTC iOS:iOS 客户端不显示远程视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!