Handle multiple screen shares
By default, a session allows one screen share at a time. The host can allow several users to share simultaneously, after which each viewer chooses which share to render.
Host: enable multiple shares
To let more than one user share at the same time, the host calls enableMultiShare. Read the current state with isMultiShareEnabled.
IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper();
// Allow simultaneous shares.
pShareHelper->enableMultiShare(true);
// Check whether multiple sharing is enabled.
bool isMultiShare = pShareHelper->isMultiShareEnabled();
Host: lock sharing
To prevent anyone other than the host from starting a share, call lockShare.
m_pVideoSDK->getShareHelper()->lockShare(true);
Choose which share to render
Each share a user has active is represented by an IZoomVideoSDKShareAction. Get the list with getShareActionList, then subscribe to the pipe of the share you want to display. Use getShareSourceId to tell concurrent shares apart, and getShareStatus to confirm a share is active before subscribing.
IVideoSDKVector<IZoomVideoSDKShareAction*>* pShareActions = pUser->getShareActionList();
for (int i = 0; i < pShareActions->GetCount(); i++)
{
IZoomVideoSDKShareAction* pShareAction = pShareActions->GetItem(i);
if (pShareAction->getShareStatus() == ZoomVideoSDKShareStatus_Start)
{
unsigned int sourceId = pShareAction->getShareSourceId();
IZoomVideoSDKRawDataPipe* pSharePipe = pShareAction->getSharePipe();
// Subscribe to pSharePipe for the share the viewer selected.
}
}
For the subscription and rendering flow, see Receive raw data.