From f4b851d2524ce72af339b98518a2c141be030f4e Mon Sep 17 00:00:00 2001 From: Sudhir Kumar Date: Fri, 14 Jun 2024 09:52:43 +0530 Subject: [PATCH 1/2] ifix: Fix the documentation of screen share iOS --- .../local-user/screen-share-guide.mdx | 62 +++++-------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/docs/ios-core/local-user/screen-share-guide.mdx b/docs/ios-core/local-user/screen-share-guide.mdx index 1a48d55e0..17571c2e5 100644 --- a/docs/ios-core/local-user/screen-share-guide.mdx +++ b/docs/ios-core/local-user/screen-share-guide.mdx @@ -5,7 +5,8 @@ tags: - ios-core --- -This document explains how to setup screen sharing on a iOS App using Dyte SDK +This document explains how to setup screen sharing on a iOS App using Dyte SDK. +To use this feature one should join the meeting with **Presets** in which Screenshare is enabled. :::warning @@ -17,8 +18,9 @@ This guide is being updated, and might not work as expected in its current form 1. Add a new Broadcast Upload Extension to your project. 2. Setup app groups -3. Have your SampleHandler class initialize DyteBroadcastHandler and proxy a few methods. -4. Update Info.plist +3. Download `DyteSampleHandler` class from [Github repo](https://github.com/dyte-io/iOS-ScreenShare) . +4. Have your SampleHandler class inherited from this downloaded class `DyteSampleHandler` . +5. Update Info.plist ### Add a new Broadcast Upload Extension to your project. @@ -43,66 +45,32 @@ Add your extension to an app group by going to your extension's target in the pr import ReplayKit import DyteiOSCore -class SampleHandler: RPBroadcastSampleHandler { - - let dyteBroadcast: DyteBroadcastHandler = DyteBroadcastHandler(); - - override init() { - super.init() - } - override func broadcastPaused() { - dyteBroadcast.broadcastPaused() - } - - override func broadcastResumed() { - dyteBroadcast.broadcastResumed() - } - - override func broadcastFinished() { - dyteBroadcast.broadcastFinished() - } - - override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) { - dyteBroadcast.broadcastStartedWithSetupInfo(setupInfo: setupInfo) - } - - override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { - let rawPointer = Unmanaged.passUnretained(sampleBuffer).toOpaque() - dyteBroadcast.processSampleBuffer(sampleBuffer: rawPointer, withType: Int64(sampleBufferType.rawValue)) - - } - -} +class SampleHandler: DyteSampleHandler {} ``` ### Modify Info.plist -Make sure **both of them** (App and Extension Info.plist) contains these keys +Make sure **both of them** (App and Extension Info.plist) contains below key. ``` RTCAppGroupIdentifier (name of the group) - RTCScreenSharingExtension - (Bundle Identifier) +``` + +Add below key inside the Info.plist of the main App. + +``` +RTCScreenSharingExtension + (Bundle Identifier of the Broadcast upload extension) ``` ![Info.plist screenshot](/static/mobile/0.x.x/ios-setup-info.png) ### Start the Screenshare -Launch the broadcast extension and call the method `enableScreenshare()` +To Launch the broadcast extension and call the method `enableScreenshare()` ```swift - -let screenShareExtensionId = Bundle.main.infoDictionary?["RTCScreenSharingExtension"] as? String; -let view = RPSystemBroadcastPickerView() -view.preferredExtension = screenShareExtensionId -view.showsMicrophoneButton = false -let selector = NSSelectorFromString("buttonPressed:") -if view.responds(to: selector) { - view.perform(selector, with: nil) -} - dyteClient.localUser.enableScreenshare() ``` From 85d30882a48dbc8a0f3f28141559236ca430637d Mon Sep 17 00:00:00 2001 From: Sudhir Kumar Date: Tue, 18 Jun 2024 11:39:24 +0530 Subject: [PATCH 2/2] docs: update the docs for stopping the ongoing screen share --- docs/ios-core/local-user/screen-share-guide.mdx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/ios-core/local-user/screen-share-guide.mdx b/docs/ios-core/local-user/screen-share-guide.mdx index 17571c2e5..b4bd18505 100644 --- a/docs/ios-core/local-user/screen-share-guide.mdx +++ b/docs/ios-core/local-user/screen-share-guide.mdx @@ -17,10 +17,10 @@ This guide is being updated, and might not work as expected in its current form ## Overview 1. Add a new Broadcast Upload Extension to your project. -2. Setup app groups +2. Setup app groups. 3. Download `DyteSampleHandler` class from [Github repo](https://github.com/dyte-io/iOS-ScreenShare) . 4. Have your SampleHandler class inherited from this downloaded class `DyteSampleHandler` . -5. Update Info.plist +5. Update Info.plist. ### Add a new Broadcast Upload Extension to your project. @@ -74,5 +74,14 @@ To Launch the broadcast extension and call the method `enableScreenshare()` dyteClient.localUser.enableScreenshare() ``` +### Stop the Screenshare + +To stop the ongoing screenshare and call the method `disableScreenshare()`. This will show the system +alert with a stop button for stopping screen share. + +```swift +dyteClient.localUser.disbaleScreenshare() +``` + ![screenshot](/static/mobile/0.x.x/ios-setup-app.png) ![screenshot](/static/mobile/0.x.x/ios-setup-demo.png)