Screen recording when my iOS app is in background with ReplayKit

后端 未结 1 845
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 20:40

I have tried Broadcast Extension. I have added that extension via target. But, I don\'t know how to record when my app is in background.

Two ways I am trying to reco

相关标签:
1条回答
  • 2020-12-10 21:19

    There is no "direct" way to store video in your app while it is in the background. ReplayKit version 2 allows you to get video sample buffer pieces in the app extensions that calls "Broadcast Upload Extension". When you say "Via Control center" it means that you start broadcast (not recording), and at the same time iOS finds your app-extension (not your application) and launch it, then begins send video sample buffers to the extension. On this step you need to decide what to do with these buffers.

    I can propose two solutions for you:

    • you can try transfer buffers to the server (and download video when main application will be launched)
    • you can try save buffers to the file using App Groups (to share this data with the main application), you can find example here.

    But you need to know that broadcast extension has been designed for buffer transferring, not to store or re rendering or compress or recode buffers. Extension has a lot of limitations based on CPU time and Memory usage (±50 MB), you can try to do anything there but if it is "heavy" operation iOS will close the extension.

    0 讨论(0)
提交回复
热议问题