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

How can I use Agora to implement Picture in Picture function on the iOS platform? #30

Closed yanyin1986 closed 1 year ago

yanyin1986 commented 1 year ago

According to the iOS PIP document, I try to draw the CVPixelBuffer on AVSampleBufferLayer to set PIP up. by this function I did make the remote view displayed on the AVSampleBufferLayer on the foreground mode.

- (void)setRemoteVideoRenderer:(id<AgoraVideoSinkProtocol> _Nullable)videoRenderer forUserId:(NSUInteger)userId;

When I swap the app into background mode, I could hear the audio but can't get the CVPixelBuffer by:

# AgoraVideoSinkProtocol

func renderPixelBuffer(_ pixelBuffer: CVPixelBuffer, rotation: AgoraVideoRotation) {}

Is there anyway to get CVPixelBuffer on the background mode?

maxxfrazer commented 1 year ago

This is a pretty hard feature to pull off, especially as I think there's not a way to have this for multiple remote users - that's why you don't see it in WhatsApp yet for example We have an example inside the API-Examples project that does it; that's a good place to start.

maxxfrazer commented 1 year ago

What version are you using @yanyin1986? I believe one of the patch updates a few months ago in 3.x made the CVPixelBuffer work in background mode when we saw it wasn't working for this exact use-case. @plutoless might know, as he's the brains behind API-Examples.

yanyin1986 commented 1 year ago

@maxxfrazer The SDK version we are using is 3.4.7.3. OK I will update the SDK version and try again. Thanks for the API-Examples, it's helpful for me! 😄

maxxfrazer commented 1 year ago

I think the patch was at least in the 3.6.x versions, so you'll for sure need to update from 3.4

maxxfrazer commented 1 year ago

Looks like this is sorted, closing issue!