AlexKMDev / WebRTC

Unofficial builds of Google WebRTC iOS Framework
https://webrtc.org/native-code/ios/
Other
292 stars 76 forks source link

Remote stream is not rendered. #45

Open lboquan opened 6 years ago

lboquan commented 6 years ago

Where self.remoteView is a RTCEAGLVideoView class.

agungpratama commented 6 years ago

same here, is there any relevant code snippet / example to how actually render the remote Stream received ? I'm using the build for a swift project

func peerConnection(_ peerConnection: RTCPeerConnection, didAdd stream: RTCMediaStream) {
    print("peerConnection delegate event : RTCPeerConnection, didAdd stream")
    if stream.videoTracks.count > 0{
        if let lastTrack = stream.videoTracks.last{
            let renderer = RTCEAGLVideoView(frame: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0))
            renderer.backgroundColor = UIColor.orange
            renderer.delegate = self
            lastTrack.add(renderer)
            self.remoteVideoView.addSubview(renderer)

        }
    }
}