Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WebRTC iOS:iOS客户端中不显示远程视频_Ios_Swift_Webrtc - Fatal编程技术网

WebRTC iOS:iOS客户端中不显示远程视频

WebRTC iOS:iOS客户端中不显示远程视频,ios,swift,webrtc,Ios,Swift,Webrtc,我正在尝试使用GoogleWebRTC pod在iOS应用程序中实现WebRTC。我可以在iOS应用程序和web客户端之间进行视频通话,在这种情况下,音频/视频工作正常。但是,当我在两台iOS设备之间进行视频通话时,没有视频(音频工作)。我已经检查了是否有远程流,是否有 let localStream = connectionFactory?.mediaStream(withStreamId: "StreamID") let audioTrack = connectionFactory?.aud

我正在尝试使用GoogleWebRTC pod在iOS应用程序中实现WebRTC。我可以在iOS应用程序和web客户端之间进行视频通话,在这种情况下,音频/视频工作正常。但是,当我在两台iOS设备之间进行视频通话时,没有视频(音频工作)。我已经检查了是否有远程流,是否有

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解决了这个问题。

在func-rtcClient(客户端:rtcClient,didReceiveRemoteVideoTrack-remoteVideoTrack:RTCVideoTrack)中
执行一个选择器,该选择器将在2秒后调用,然后在该选择器中将曲目添加到remoteview

据我所知,您可以在首次创建本地视频曲目时添加远程视频曲目,然后视频曲目将在从对等连接接收时自动生成帧,WebRTC iOS客户端的示例代码:

- (void)createMediaSenders {
    RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints];
    RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints];
    if (_isAudioEnabled) {
        RTCAudioTrack *track = [_factory audioTrackWithSource:source trackId:kDSAudioTrackId];
        [_peerConnection addTrack:track streamIds:@[ kDSMediaStreamId ]];
    }
    if (_isVideoEnabled) {
        _localVideoTrack = [self createLocalVideoTrack];
        if (_localVideoTrack) {
            [_peerConnection addTrack:_localVideoTrack streamIds:@[ kDSMediaStreamId ]];

            // Create remote video track
            RTCVideoTrack *track = (RTCVideoTrack *)([self videoTransceiver].receiver.track);
            [_delegate appRTC:self didReceiveRemoteVideoTrack:track];
        }
    }
}

我想不是这样的。我在我的两个同伴身上都有相同的轨迹ID和流ID,它们连接和传输数据没有问题。我一定是做错了什么,因为无论何时我在ids视频中给出一个静态字符串值都不起作用。但是提供了一个与其他同行不同的动态价值works@Rezwan我没有得到你的答案是不是PeerConnection.IceServer(“stun:stun.l.google.com:19302”)@guru不,我想是这样的:let videoTrack=connectionFactory?.videoTrack(with:videoSource!,trackId:“VideoTrackID”)@guru,我的问题是“trackId”对于VideoTrack,两边都是一样的。他们必须是不同的。你好,我有相同的问题,你有任何其他的解决方案吗?我也面临着远程流的问题,你有解决方案吗。我有,但不记得这个问题。对不起,那是两年半以前的事了。