View screen shares from other participants during a call. The iOS SDK can receive and display screen shares initiated from web clients.
The iOS Calls SDK does not support initiating screen sharing. Screen sharing can only be started from web clients. iOS participants can view shared screens.
How It Works
When a web participant starts screen sharing:
- The SDK receives the screen share stream
- The call layout automatically adjusts to display the shared screen prominently
- iOS participants can view the shared content
Listen for Screen Share Events
Monitor when participants start or stop screen sharing:
class CallViewController: UIViewController, ParticipantEventListener {
override func viewDidLoad() {
super.viewDidLoad()
CallSession.shared.addParticipantEventListener(self)
}
deinit {
CallSession.shared.removeParticipantEventListener(self)
}
func onParticipantStartedScreenShare(participant: Participant) {
print("\(participant.name ?? "") started screen sharing")
// Layout automatically adjusts to show shared screen
}
func onParticipantStoppedScreenShare(participant: Participant) {
print("\(participant.name ?? "") stopped screen sharing")
// Layout returns to normal view
}
// Other callbacks...
func onParticipantJoined(participant: Participant) {}
func onParticipantLeft(participant: Participant) {}
func onParticipantListChanged(participants: [Participant]) {}
func onParticipantAudioMuted(participant: Participant) {}
func onParticipantAudioUnmuted(participant: Participant) {}
func onParticipantVideoPaused(participant: Participant) {}
func onParticipantVideoResumed(participant: Participant) {}
func onParticipantStartedRecording(participant: Participant) {}
func onParticipantStoppedRecording(participant: Participant) {}
func onParticipantHandRaised(participant: Participant) {}
func onParticipantHandLowered(participant: Participant) {}
func onDominantSpeakerChanged(participant: Participant) {}
}
@interface CallViewController () <ParticipantEventListener>
@end
@implementation CallViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[CallSession shared] addParticipantEventListener:self];
}
- (void)dealloc {
[[CallSession shared] removeParticipantEventListener:self];
}
- (void)onParticipantStartedScreenShareWithParticipant:(Participant *)participant {
NSLog(@"%@ started screen sharing", participant.name);
// Layout automatically adjusts to show shared screen
}
- (void)onParticipantStoppedScreenShareWithParticipant:(Participant *)participant {
NSLog(@"%@ stopped screen sharing", participant.name);
// Layout returns to normal view
}
// Other callbacks...
@end
Check Screen Share Status
Use the isPresenting property on the Participant object to check if someone is sharing their screen:
func onParticipantListChanged(participants: [Participant]) {
if let presenter = participants.first(where: { $0.isPresenting }) {
print("\(presenter.name ?? "") is currently sharing their screen")
}
}
- (void)onParticipantListChangedWithParticipants:(NSArray<Participant *> *)participants {
for (Participant *p in participants) {
if (p.isPresenting) {
NSLog(@"%@ is currently sharing their screen", p.name);
break;
}
}
}