swift – Agora iOS SDK: Distant video not displaying for my part

0
1
swift – Agora iOS SDK: Distant video not displaying for my part


I am attempting to show a distant display share video utilizing the Agora iOS SDK.
I am establishing the video canvas after receiving the didJoinedOfUid delegate, however the preview just isn’t exhibiting up.
That is my configuration for establishing my View.

    func createScreenShareView(uid: UInt, agoraEngine: AgoraRtcEngineKit) {
    guard isStreamActive else {
        print("FOO: Display share not lively. Skipping createScreenShareView.")
        return
    }
    print("FOO: Including remoteShareView to fundamental view for uid (uid)")
    view.addSubview(remoteShareView)
    view.bringSubviewToFront(remoteShareView)

    NSLayoutConstraint.activate([
        remoteShareView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
        remoteShareView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
        remoteShareView.widthAnchor.constraint(equalTo: view.widthAnchor),
        remoteShareView.heightAnchor.constraint(equalTo: view.heightAnchor),
    ])
    print("FOO: Activated constraints for remoteShareView")

    let videoCanvas = AgoraRtcVideoCanvas()
    videoCanvas.uid = uid
    videoCanvas.view = remoteShareView
    videoCanvas.renderMode = .match
    print("FOO: Establishing distant video for uid (uid)")
    agoraEngine.setupRemoteVideo(videoCanvas)
}

In my AgoraRtcEngineDelegate, I name a delegate technique to inform about receiving video stream and move the uid and engine to view controller.

func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int {
        self.uid = uid
               if let engine = agoraEngine {
            print("FOO: calling screenDelegate?.didJoinedOfUid for uid (uid)")
            screenDelegate?.didJoinedOfUid(uid: uid, elapsed: elapsed, agoraEngine: engine)
        }
    }

Right here is the implementation for that

 func didJoinedOfUid(uid: UInt, elapsed: Int, agoraEngine: AgoraRtcEngineKit) {
        print("FOO: didJoinedOfUid referred to as with uid (uid), elapsed (elapsed) ms")
        createScreenShareView(uid: uid, agoraEngine: agoraEngine)
    }

    func didOfflineOfUid(uid: UInt, agoraEngine: AgoraRtcEngineKit) {
        print("FOO: didOfflineOfUid referred to as with uid (uid)")
        stopSharing(uid: uid, agoraEngine: agoraEngine)
    }

The view is getting added and visual however distant video stream just isn’t being proven . This occurred once I shared from Android to iOS.

LEAVE A REPLY

Please enter your comment!
Please enter your name here