Core features
The Video SDK for Linux lets an app share the contents of the device's screen or a single window with the session. You start and manage sharing with IZoomVideoSDKShareHelper, obtained from getShareHelper. To draw over shared content, see Annotation. When more than one user shares at once, see Handle multiple screen shares.
Share a screen
To share an entire display, call startShareScreen with the ID of the monitor you want to share.
IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper();
if (!pShareHelper) return;
ZoomVideoSDKErrors err = pShareHelper->startShareScreen(monitorID);
if (err == ZoomVideoSDKErrors_Success)
{
// Started sharing the screen.
}
Share a window
To share a single window instead of a whole display, call startShareView with the window handle.
IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper();
if (!pShareHelper) return;
ZoomVideoSDKErrors err = pShareHelper->startShareView(handle);
On Linux, the window handle string identifies an X11 window in the form hostname:display_number-screen_number(x, y, width, height)-winid, for example :0-0(0,0,1920,1080)-34563456.
Share device audio
To include the device's audio with your share, call enableShareDeviceAudio before you start sharing.
pShareHelper->enableShareDeviceAudio(true);
To feed your own frames into a share instead of capturing a screen or window, share an external source. For details, see Send raw data.
Stop, pause, and resume sharing
Call stopShare to end the share. To temporarily stop sending share frames without ending the share, call pauseShare, and resumeShare to continue.
pShareHelper->pauseShare();
pShareHelper->resumeShare();
pShareHelper->stopShare();
Verify your share started
After you start sharing, the SDK calls onUserShareStatusChanged and passes an IZoomVideoSDKShareAction. Read the status from the action object with getShareStatus.
void CExampleListener::onUserShareStatusChanged(IZoomVideoSDKShareHelper* pShareHelper, IZoomVideoSDKUser* pUser, IZoomVideoSDKShareAction* pShareAction)
{
if (pShareAction && pShareAction->getShareStatus() == ZoomVideoSDKShareStatus_Start)
{
// The user has successfully started sharing to the session.
}
}
Render another user's share
To render a share, get the user's share actions with getShareActionList, then subscribe to the IZoomVideoSDKRawDataPipe from the share action you want to display. Each IZoomVideoSDKShareAction represents one share, so this also covers the case where a user has more than one share active.
IVideoSDKVector<IZoomVideoSDKShareAction*>* pShareActions = pUser->getShareActionList();
if (pShareActions && pShareActions->GetCount() > 0)
{
IZoomVideoSDKShareAction* pShareAction = pShareActions->GetItem(0);
IZoomVideoSDKRawDataPipe* pSharePipe = pShareAction->getSharePipe();
// Subscribe to pSharePipe to render the shared content.
}
For the subscription and rendering flow, see Receive raw data. To let viewers pick between simultaneous shares, see Handle multiple screen shares.