Skip to content

Screen Sharing Set View

adamrangs edited this page Aug 8, 2022 · 1 revision

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

MediaOption option = MediaOption. audioVideoSharing(new Pair<>(localView, remoteView),shareView);

webex.phone().dial("[email protected]", option, (result) -> {
            if (result.isSuccessful()) {
                call = result.getData();
                call.setObserver(callObserver);
            }
            //...
});

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

MediaOption option = MediaOption. audioVideoSharing(new Pair<>(localView, remoteView),null);

webex.phone().dial("[email protected]", option, (result) -> {
    if (result.isSuccessful()) {
        call = result.getData();
        call.setObserver(callObserver);
    }
    //...
});


@Override
public void onMediaChanged(MediaChangedEvent mediaChangedEvent) {
    if (mediaChangedEvent instanceof RemoteSendingSharingEvent) {
        if (((RemoteSendingSharingEvent) mediaChangedEvent).isSending()) {
            mediaChangedEvent.getCall().setSharingRenderView(shareView);
        } else if (!((RemoteSendingSharingEvent) mediaChangedEvent).isSending()) {
            mediaChangedEvent.getCall().setSharingRenderView(null);
        }
    }
}
Clone this wiki locally