Using the Miniview with the iOS SDK
This document is the tutorial to enable the screen sharing feature.
-
Create a new target in your Xcode project, using the template of `Broadcast Upload Extension`.
Please make sure the broadcast extension is embeded in the host app.
You might need to set `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` = NO and `ENABLE_USER_SCRIPT_SANDBOXING` = NO for the broadcast extension target in order to make Cocoapods work properly.
-
Add a target for the new broadcast extension in your Podfile.
target 'BroadcastExtension' do pod 'HLSDK/ScreenSharing', '17.6.1' end
Run
pod install
to update the dependencies for the broadcast extension -
Create an app group and add the broadcast extension and the host app to the app ground
-
Change the SampleHandler to inherit from `HLScreenSharingBroadcastSampleHandler`
#import <ReplayKit/ReplayKit.h> #import <HLSDKScreenSharing/HLSDKScreenSharing.h> @interface SampleHandler : HLScreenSharingBroadcastSampleHandler @end
Remove all the generated empty methods in
SampleHandler
and overwritegetAppGroupName
to return the app group name. If the app group name isn’t correct, the screen sharing feature will not work properly#import "SampleHandler.h" @implementation SampleHandler - (NSString*)getAppGroupName { return @"group.com.helplightning.sdk.SampleObjC.BroadcastExtension"; } @end
-
In the host app code, implement this new delegate in `HLClientDelegate`. The delegate method should return a dictionary with two keys:
- (NSDictionary*) hlCallNeedScreenSharingInfo:(id<HLGenericCall>)call { return @{ kHLCallPluginScreenSharingAppGroupName: @"group.com.helplightning.sdk.SampleObjC.BroadcastExtension", kHLCallPluginScreenSharingBroadcastExtensionBundleId: @"com.helplightning.sdk.SampleObjC.BroadcastExtension" }; }
- `kHLCallPluginScreenSharingAppGroupName` is the app group name shared by the host app and the broadcast extension
- `kHLCallPluginScreenSharingBroadcastExtensionBundleId` is the bundle id of the broadcast extension
-
Method 1: In-Call Share Menu -> Screen
-
Method 2: Add `Screen Recording` to iOS Control Center.
Choose the broadcast extension to start recording
If users try to start screen sharing when there is no active HL call, the broadcast will be stopped automatically in a few seconds.