title: How can I render RTCVideoFrame in iOS Picture in Picture?
body: <p>Could you please help us with the following question:</p>
  <p>We have an <a href="https://webrtc.googlesource.com/src//+/1845922d5a1bf9c27deeffb4a8c8daea124434c1/sdk/objc/base/RTCVideoFrame.h" rel="nofollow noreferrer">RTCVideoFrame</a> object, that is being rendered like this:</p>
  <ul>
  <li>when <a href="https://webrtc.googlesource.com/src//+/1845922d5a1bf9c27deeffb4a8c8daea124434c1/sdk/objc/base/RTCVideoRenderer.h#29" rel="nofollow noreferrer">renderFrame</a> (from WebRTC library) is being called, it copies itself into a local <code>CVImageBufferRef _pixelBufferRef</code></li>
  <li>when <a href="https://github.com/flutter/engine/blob/main/shell/platform/darwin/common/framework/Headers/FlutterTexture.h#L22-L23" rel="nofollow noreferrer">copyPixelBuffer</a> is being called, <code>_pixelBufferRef</code>'s contents are returned, so they can be rendered as a Flutter texture (a Flutter texture is kind of like a canvas in html - it renders pixel to pixel)</li>
  </ul>
  <p>The logic above happens in a class called <code>FlutterRTCVideoRenderer</code>.</p>
  <p>We would like to add picture in picture functionality (for devices that support it).</p>
  <p>There would be a callback somewhere in the app and a method <code>startPip</code> in the FlutterRTCVideoRenderer class. When <code>startPip</code> is called, the RTCVideoFrame should be rendered in a native popup window.</p>
  <p>We're not really sure how to do it.</p>
  <p>FlutterRTCVideoRenderer class source code: <a href="https://github.com/flutter-webrtc/flutter-webrtc/blob/master/common/darwin/Classes/FlutterRTCVideoRenderer.m" rel="nofollow noreferrer">https://github.com/flutter-webrtc/flutter-webrtc/blob/master/common/darwin/Classes/FlutterRTCVideoRenderer.m</a></p>