Skip to content

Screen Sharing Set View

Rohit Sharma edited this page Aug 13, 2022 · 2 revisions

In order to view the screen/content sharing from remote participant, the MediaOption used by dial or answer must be created by audioVideoScreenShare function.

let option = MediaOption.audioVideoScreenShare(video: (localVideoView, remoteVideoView), screenShare: remoteScreenView)

webex.phone.dial("[email protected]", option: option) { ret in
    switch ret {
    case .success(let call):
        call.onConnected = {
            // ...
        }
        call.onDisconnected = { reason in
            // ...
        }
    case .failure(let error):
        // failure
    }
}

You can also provide a view only when the other party starts the screen sharing.

let option = MediaOption.audioVideoScreenShare(video: (localVideoView, remoteVideoView))

webex.phone.dial("[email protected]", option: option) { ret in
    switch ret {
    case .success(let call):
        call.onConnected = {
            // ...
        }
        call.onDisconnected = { reason in
            // ...
        }
        call.onMediaChanged = { changed in
            switch changed {
                ...
            case .remoteSendingScreenShare(let sending):
                call.screenShareRenderView = sending ? remoteScreenView : nil
            }
        }
    case .failure(let error):
        // failure
    }
}