AgoraIO / AgoraRtcEngine_iOS

iOS Package for Agora Video RTE SDK. Perfect for video calls and live streaming.
https://agoraio.github.io/AgoraRtcEngine_iOS/
MIT License
58 stars 17 forks source link

pushExternalVideoFrame returns false #19

Closed ChurikiTenna closed 2 years ago

ChurikiTenna commented 2 years ago

pushExternalVideoFrame returns false although the setExternalVideoSource is set to true.

Normal AgoraCameraSourcePush method does works, but when I switch to my custom push, it fails. What could be causing this? Is there any way that I can see a log?

func updateClientRole(_ role: AgoraClientRole) {
        print("updateClientRole,", role.title)
        self.role = role
        if role == .broadcaster {
            makeConfig(mirror: false)

            agoraKit.enableLocalVideo(true)
            agoraKit.enableLocalAudio(true)
            agoraKit.enableAudioVolumeIndication(250, smooth: 3, report_vad: true)
            agoraKit.setAudioProfile(.speechStandard, scenario: .communication)
            agoraKit.setExternalVideoSource(true, useTexture: true, pushMode: true)

// this works
            localVideoView = CustomVideoSourcePreview(frame: view.frame)
            videosView.appendBackgroundViewContainer(uid: myUID, itsTeacher: self.amTeacher).addSubview(localVideoView!)
            customCamera = AgoraCameraSourcePush(delegate: self, videoView: localVideoView!)
            self.customCamera?.startCapture(ofCamera: .front)
            self.localVideoView?.bindFrameToSuperviewBounds()
// this does not work
            let myVideoView = videosView.appendBackgroundViewContainer(uid: myUID, itsTeacher: self.amTeacher)
            avatarView = MyAvatarView(to: myVideoView)
            avatarView?.delegate = self
}

func myVideoCapture(_ capture: AgoraCameraSourcePush?, didOutputSampleBuffer pixelBuffer: CVPixelBuffer, rotation: Int, timeStamp: CMTime) {

        let videoFrame = AgoraVideoFrame()
        videoFrame.format = 12
        videoFrame.textureBuf = pixelBuffer
        videoFrame.time = timeStamp
        videoFrame.rotation = Int32(rotation)
        let success = agoraKit?.pushExternalVideoFrame(videoFrame)
        print("myVideoCapture.success",success) -> this print "myVideoCapture.success Optional(false)"
    }
maxxfrazer commented 2 years ago

I'd recommend taking a look at API-Examples to see the implementation there.

maxxfrazer commented 2 years ago

Closing due to no response.