A flutter plugin of the launcher used to open RPSystemBroadcastPickerView
for iOS
Note: Only support iOS
Shared preferences with App Group: Shared preference supporting iOS App Group capability (using -[NSUserDefaults initWithSuiteName:]
)
If you need to implement screen capture on Android, I have also developed a helpful plugin:
MediaProjection Creator: A flutter plugin of the creator used to create MediaProjection
instance (with requesting permission) for Android
To use this plugin, add replay_kit_launcher
as a dependency in your pubspec.yaml file.
-
Start
/// Please fill in the name of the Broadcast Extension in your project, which is the file name of the `.appex` product /// [extensionName] is your `BroadCast Upload Extension` target's `Product Name`, /// or to be precise, the file name of the `.appex` product of the extension ReplayKitLauncher.launchReplayKitBroadcast('BroadcastDemoExtension');
-
Stop
Before using this method, you need to write some native code in the iOS native project to cooperate with it. For details, please refer to
/example/ios/BroadcastDemoExtension/ZGBroadcastManager.m
// Please fill in the CFNotification name in your iOS native project ReplayKitLauncher.finishReplayKitBroadcast('ZGFinishBroadcastUploadExtensionProcessNotification');
Please see the example app of this plugin for a full example.
https://github.com/zegoim/zego-express-example-screen-capture-flutter
This demo implements screen live broadcast on iOS/Android by using the ZEGO Express Audio and Video Flutter SDK
Flutter screen capture solution | Flutter 移动端屏幕采集方案分享
-
What is the
.appex
product file?Open your flutter project's iOS native workspace (
Runner.xcworkspace
), selectXcode
->File
->New
->Target
and create a newBroadcast Upload Extension
target.Click
Next
and then fill in theProduct Name
field. This field is the file name of the.appex
product file. -
How to stop the ReplayKit broadcast process after launching?
There are two ways to stop the ReplayKit broadcast process, one is to actively click the red button at the top of the iPhone screen, and the other is to call the
-[RPBroadcastSampleHandler finishBroadcastWithError:]
method provided by ReplayKit broadcast sub-process'sSampleHandler
instance object.But the question is how to invoke the method of the Replaykit sub-process's object on flutter side?
One solution is to use cross-process notifications
CFNotificationCenterGetDarwinNotifyCenter
, post notifications on the flutter side withMethod Channel
, receive notifications on the iOS Replaykit sub-process side, and then actively invoke thefinishBroadcastWithError:
method after receiving the notification.The flutter plugin's
ReplayKitLauncher.finishReplayKitBroadcast()
method does this job: it usesMethod Channel
on the flutter side to notify the iOS native main process side to post cross-process notifications, the paramnotificationName
is the CFNotification name.So you need to refer to the
/example/ios/BroadcastDemoExtension/ZGBroadcastManager.m
file to implement code on your project'siOS ReplayKit broadcast extension sub-process side
to receive notifications and invokeSampleHandler
'sfinishBroadcastWithError:
method to stop the ReplayKit broadcast sub-process extension.
Everyone is welcome to contribute code via pull requests, to help people asking for help, to add to our documentation, or to help out in any other way.