HomeiOS Developmentswift - Agora iOS SDK: Distant video not displaying for my part

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


I am attempting to show a distant display screen share video utilizing the Agora iOS SDK.
I am organising the video canvas after receiving the didJoinedOfUid delegate, however the preview shouldn’t be displaying up.
That is my configuration for organising my View.

    func createScreenShareView(uid: UInt, agoraEngine: AgoraRtcEngineKit) {
    guard isStreamActive else {
        print("FOO: Display screen share not energetic. Skipping createScreenShareView.")
        return
    }
    print("FOO: Including remoteShareView to foremost 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: Organising distant video for uid (uid)")
    agoraEngine.setupRemoteVideo(videoCanvas)
}

In my AgoraRtcEngineDelegate, I name a delegate methodology 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 shouldn’t be being proven . This occurred after I shared from Android to iOS.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments