Screen Sharing button not working

I’m trying to share my screen following documentation steps, but I have a problem. I can’t share my screen.

onClickShareScreen function is called and in this function I call to MobileRTC.shared().getMeetingService().startAppShare(), but then nothing happens. I think I did something bad, because this step isn’t occur: “The SDK should notify your app using the (void)onSinkMeetingActiveShare:(NSUInteger)userID instance with the user ID who started the screen share.”

Can you help me, please?

Thanks in advance,

Roberto

Hi Roberto,

Thanks for the post. Which doc are you referring to? If you follow the doc here:https://marketplace.zoom.us/docs/sdk/native-sdks/iOS/mastering-zoom-sdk/in-meeting-function/zoom-meeting-ui/screen-share, you will need to create a broadcast extension, and then invoke the screen recording feature in the system for screen sharing.

Please have a try. Thanks!

Thanks for the answer @Carson_Chen,

I created a broadcast extension, defined group, set onClickShareScreen function:

func onClickShareScreen(_ parentVC: UIViewController) {
        guard let service = MobileRTC.shared().getMeetingService() else { return }
        
        if service.isStartingShare() {
            service.stopAppShare()
        } else {
            service.startAppShare()
        }
    }

but then… func onSinkMeetingActiveShare( _ userID: UInt) isn’t been called.

I don’t know If I need to do some step after “startAppShare()”, but It isn’t working.

Hi @rob.gomez.mu,

Thanks for the reply. Actually the startAppShare and stopAppShare is for the appShareWithView interface(We have another method to share screen but we do recommend using the broadcast extension). The broadcast extension is rely on Apple’s services so you may use something like https://developer.apple.com/documentation/replaykit/rpsystembroadcastpickerview?language=objc to invoke the screen sharing. Or you could manually start the screen recording by following the instruction here: https://support.zoom.us/hc/en-us/articles/115005890803-iOS-Screen-Sharing

Hope this helps. Thanks!

I didn’t see any real solution, Do you have any complete share screen example to show? Because I think that documentation isn’t clear :frowning:

I’ve been trying screen share for weeks and still not able to broadcast. A real sample would be really helpful.

1 Like

@Carson_Chen my ‘onClickShareScreen’ function is:

func onClickShareScreen(_ parentVC: UIViewController) {
guard let service = MobileRTC.shared().getMeetingService() else { return }

    if service.isStartingShare() {
        service.stopAppShare()
    } else {
        service.startAppShare()
        
        let broadcastPicker = RPSystemBroadcastPickerView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width/2, height: UIScreen.main.bounds.size.height/2))
        broadcastPicker.preferredExtension = "MyExtension"

        parentVC.view.addSubview(broadcastPicker)
        parentVC.view.bringSubviewToFront(broadcastPicker)
    }
}

Is it correct?

Hi @rob.gomez.mu,

If you are using the broadcast extension to do screen sharing, you do not need the startAppShare and the stopAppShare. You could simply implement the broadcast picker in the onClickShareScreen method like the following:

- (void)onClickShareScreen:(UIViewController *)parentVC
{
     if (@available(iOS 12.0, *)) {
         RPSystemBroadcastPickerView *broadcastView = [[RPSystemBroadcastPickerView alloc] init];
            broadcastView.preferredExtension = @"Extension bundle ID";
            broadcastView.tag = "NSInteger here";
            
            [self.mainVC.view addSubview:broadcastView];
         
         broadcastView = [self.mainVC.view viewWithTag:"NSInteger here"];
         if (!broadcastView) return;

         for (UIView *subView in broadcastView.subviews) {
             if ([subView isKindOfClass:[UIButton class]])
             {
                 UIButton *broadcastBtn = (UIButton *)subView;
                 [broadcastBtn sendActionsForControlEvents:UIControlEventAllTouchEvents];
                 break;
             }
         }
     }
}

Then you could trigger the picker by pressing the share button.

Hope this helps. Thanks!

hi @Carson_Chen
how we can broadcast share screen if i am using custom meeting ui

Hi @arsallion313,

Thanks for the reply. For Custom UI, it will be the same way as how it is implemented in the Zoom default UI.

Thanks!