iOS : Zoom custom UI cannot able to see the screen shared by the host

Description
I have built an application that uses custom UI, am using MobileRTCVideoView to show the participant video and the host video, but if the host shares his/her screen I cannot able to see it. I can able to see only the host video, I cannot see the shared screen.

Hey @vignesh,

Thanks for using the dev forum! It is good to see you again :slight_smile:

To render sharing content you must use a MobileRTCActiveShareView instead of a generic MobileRTCVideoView. The code to render the view is very similar to the MobileRTCVideoView, but instead of using showAttendeeVideoWithUserID you would use showActiveShareWithUserID.

Let me know if you run into any issues there.
Thanks!
Michael

Hello @Michael_Condon,
Thanks for your reply, I tried using what you have mentioned, but the screen is not rendering. Am adding the code snippet, please check it and let me know what am doing wrong.

/** Declaring the variables **/

var participantView : MobileRTCActiveShareView = MobileRTCActiveShareView()

/** Getting the user id from this built in function **/

func onSinkMeetingActiveVideo(_ userID: UInt) {

    showAttendeeActiveShareView(videoView: participantView, userID: (MobileRTC.shared().getMeetingService()?.activeShareUserID())!)

}

/** This function I use to render the video view **/

func showAttendeeActiveShareView(videoView : MobileRTCActiveShareView, userID : UInt) {

    videoView.showActiveShare(withUserID: userID)
      
           guard let ms = MobileRTC.shared().getMeetingService() else {return}
           
           let size: CGSize = (ms.getUserVideoSize(userID))
           
           if __CGSizeEqualToSize(size, .zero) {
               return
           }
           videoView.setVideoAspect(MobileRTCVideoAspect_PanAndScan)
    
}

Hey @vignesh,

Try showing the active share within the callback onSinkMeetingActiveShare. Then pass in the userID from that function.

Let me know what happens.
Thanks!
Michael

Hello @Michael_Condon,
Tried it, still only the host video is shown, cannot able to see the screen shared by him.

Hey @vignesh,

Are you using a broadcast extension to share the screen?

Thanks!
Michael

Hello Micheal,
Am not sharing the screen, basically in my application I have a host and a client, the host shares screen from his/her desktop client and am just viewing the shared screen from my mobile application, when the host shares the screen. I can see their video only not the screen that was shared.

Hey @vignesh,

I see, my mistake. :slight_smile: Let me try and reproduce this on my end. What SDK version are you using?

Thanks!
Michael

Hello @Michael_Condon,
Am using the latest version v5.2.42037.1112

Hey @vignesh,

Unfortunately, I was unable to reproduce this issue. I am curious if the sizing is causing issues. Is it possible that the view that you are using to render the share content is underneath another view, sized incorrectly, or not properly added to the view hierarchy? I have made this mistake in the past. To troubleshoot, I created a container view with a hardcoded size and a red background (just to make sure I could see where the view is supposed to be on the screen), then I added the share view inside the container view.

Here is some sample code that I used. This code renders the local user’s video in the corner, the active meeting video in the background of the view, and when someone begins to share, a new view is added that renders the share view on top of the active meeting video.

import UIKit
import MobileRTC

class CustomMeetingUIViewController: UIViewController {
    // These are just some container views that have storyboard contraints
    @IBOutlet weak var userCameraView: UIView!
    @IBOutlet weak var meetingView: UIView!

    // A button to leave the meeting
    @IBAction func leaveButtonPressed(_ sender: UIButton) {
        MobileRTC.shared().getMeetingService()?.leaveMeeting(with: LeaveMeetingCmd_Leave)

        let rootViewController = self.navigationController?.viewControllers.first as? ViewController
        MobileRTC.shared().getMeetingService()?.delegate = rootViewController
        navigationController?.popToRootViewController(animated: true)
    }

    override func viewDidLoad() {
        self.navigationItem.setHidesBackButton(true, animated: true)
    }

    override func viewDidAppear(_ animated: Bool) {
        if let firstUserWhoIsntLocalUser = MobileRTC.shared().getMeetingService()?.activeUserID() {
            let activeMeetingView = MobileRTCActiveVideoView(frame: meetingView.bounds)
            activeMeetingView.setVideoAspect(MobileRTCVideoAspect_PanAndScan)
            meetingView.addSubview(activeMeetingView)
            activeMeetingView.showAttendeeVideo(withUserID: firstUserWhoIsntLocalUser)
        }

        if let userID = MobileRTC.shared().getMeetingService()?.myselfUserID() {
            let usersVideoView = MobileRTCVideoView(frame: userCameraView.bounds)
            usersVideoView.setVideoAspect(MobileRTCVideoAspect_PanAndScan)
            userCameraView.addSubview(usersVideoView)
            usersVideoView.showAttendeeVideo(withUserID: userID)
        }
    }
}

// MARK: - MobileRTCMeetingServiceDelegate

// Conform CustomMeetingUIViewController to MobileRTCMeetingServiceDelegate.
// MobileRTCMeetingServiceDelegate listens to updates about meetings, such as meeting state changes, join attempt status, meeting errors, etc.
extension CustomMeetingUIViewController: MobileRTCMeetingServiceDelegate {

    // Is called upon in-meeting errors, join meeting errors, start meeting errors, meeting connection errors, etc.
    func onMeetingError(_ error: MobileRTCMeetError, message: String?) {
        switch error {
        case MobileRTCMeetError_PasswordError:
            print("Could not join or start meeting because the meeting password was incorrect.")
        default:
            print("Could not join or start meeting with MobileRTCMeetError: \(error) \(message ?? "")")
        }
    }

    // Is called when the user joins a meeting.
    func onJoinMeetingConfirmed() {
        print("Join meeting confirmed.")
    }

    // Is called upon meeting state changes.
    func onMeetingStateChange(_ state: MobileRTCMeetingState) {
        print("Meeting state changed")
    }
}

extension CustomMeetingUIViewController: MobileRTCShareServiceDelegate {

    func onAppShareSplash() {
        return
    }

    func onSinkMeetingActiveShare(_ userID: UInt) {
        // Add users share stream to a view, then add the view to in a container view.
        // Note, I used activeShareUserID here, but userID would also work.
        if let activeShareUser = MobileRTC.shared().getMeetingService()?.activeShareUserID() {
            let activeMeetingView = MobileRTCActiveShareView(frame: meetingView.bounds)
            activeMeetingView.setVideoAspect(MobileRTCVideoAspect_PanAndScan)
            meetingView.addSubview(activeMeetingView)
            activeMeetingView.showActiveShare(withUserID: activeShareUser)
        }
    }

    func onSinkMeetingShareReceiving(_ userID: UInt) {
        return
    }

    func onSinkShareSizeChange(_ userID: UInt) {
        return
    }
}

Thanks!
Michael

@Michael_Condon Thanks for sharing the code snippet. I got stuck with an audio issue. Will solve it and try your sample, thanks a ton for your support.

Hello @Michael_Condon,
Share feature is working fine, thanks a ton for your patience and support. Now I have an audio issue. I have raised a ticket already. Thanks a lot for your help.

Hey @vignesh,

Awesome! I am super happy to hear that sharing is working!
This is the post of your audio issue correct? iOS : Audio is not working when multiple people join the meeting. Speaker (person) gets muted while talking

Thanks!
Michael

Hello @Michael_Condon,
Exactly that is the ticket, please help me with this.

@vignesh

Will do! :slight_smile:

Thank you @Michael_Condon

1 Like