# Screen sharing The Video SDK enables an app to live stream the contents of the device's screen or windows with the session. ## Share screen You can share a specific screen with the session using `startShareScreen` within `IZoomVideoSDKShareHelper`. This method takes in a `monitorID` parameter that specifies the name of the screen that will be shared. ```cpp // Get available monitors. std::vector vecMonitorArray; EnumDisplayMonitors(NULL, NULL, &MyInfoEnumProc, reinterpret_cast(&vecMonitorArray)); std::wstring strMonitorId; if (vecMonitorArray.size() <= 0) strMonitorId = _T(""); else strMonitorId = vecMonitorArray[0]; // Obtain the IZoomVideoSDKShareHelper instance to perform sharing actions. IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper(); if (!pShareHelper) return; // Set to true to enable sharing device audio while screen sharing pShareHelper->enableShareDeviceAudio(true); // Pass in id of the monitor to share. int err = pShareHelper->startShareScreen(strMonitorId.c_str()); CString strInfo; if (err == ZoomVideoSDKErrors_Success) { // Started sharing screen. } else { // Screen sharing failed. } ``` ## Share window You can also share a window handle instead. Use `startShareView` within `IZoomVideoSDKShareHelper` to begin sharing a window using its `hWnd`. ```cpp // Obtain the IZoomVideoSDKShareHelper instance to perform sharing actions. IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper(); if (!pShareHelper) return; int err = pShareHelper->startShareView(hWnd); if (err == ZoomVideoSDKErrors_Success) { // Started sharing window. } else { // Window sharing failed. } ``` ## Stop sharing Call `stopShare` within `IZoomVideoSDKShareHelper` to stop sharing. ```cpp // Obtain the IZoomVideoSDKShareHelper instance to perform sharing actions. IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper(); if (!pShareHelper) return; pShareHelper->stopShare(); ``` ## Verify screen share After completing the previous steps to share your screen, you can verify that your screen share is visible on another device by responding to the following callback within your `IZoomVideoSDKDelegate`. ```cpp void CExampleListener::onUserShareStatusChanged(IZoomVideoSDKShareHelper* pShareHelper, IZoomVideoSDKUser* pUser, ZoomVideoSDKShareStatus status) { if (status == ZoomVideoSDKShareStatus_Start) { // The user has successfully started sharing to the session. } } ``` ## Rendering another user's screen share Similar to a [user's video stream](/docs/video-sdk/linux/video/), you can also render a user's share stream by subscribing to their share pipe. ```cpp // CExampleRenderer.h class CExampleRenderer : public IZoomVideoSDKRawDataPipeDelegate { // ... public: // IZoomVideoSDKRawDataPipeDelegate virtual void onRawDataFrameReceived(YUVRawDataI420* data_); virtual void onRawDataStatusChanged(RawDataStatus status); // ... } // CExampleRenderer.cpp ZoomVideoSDKErrors CExampleRenderer::Subscribe(IZoomVideoSDKUser* pUser, ZoomVideoSDKRawDataType dataType, int size) { // Set the resolution. ZoomVideoSDKResolution resolution = ZoomVideoSDKResolution_360P; // Get the share pipe for the user. IZoomVideoSDKRawDataPipe* pPipe = NULL; pPipe = pUser->GetSharePipe(); if (!pPipe) return; // Call subscribe. err = pPipe->subscribe(resolution, this) return err; } ``` ## Receive video frame The class above inherits from `IZoomVideoSDKRawDataPipeDelegate`, which provides two callbacks. `onRawDataFrameReceived(YUVRawDataI420* data_)*` provides video data in YUV format. This data parameter `YUVRawDataI420` provides everything needed to render the single video frame data. ```cpp void CExampleRenderer::onRawDataFrameReceived(YUVRawDataI420* data_) { // Get frame data resolution. data_->GetStreamWidth(); data_->GetStreamHeight(); // Get frame buffer. data_->GetYBuffer(); data_->GetUBuffer(); data_->GetVBuffer(); // Get frame rotation data_->GetRotation(); } ``` ## Change in raw data status The SDK calls `onRawDataStatusChanged(RawDataStatus status)` when there is a change in raw data status. ```cpp void CExampleRenderer::onRawDataStatusChanged(RawDataStatus status) { if (status == RawData_On) { // Now subscribed to user's data. } else { // No longer subscribed to user's data. } } ``` ## Unsubscribe from user's share pipe To stop rendering user content, call `unsubscribe() ` to unsubscribe from the user's video. ```cpp void CExampleRenderer::unSubscribe(IZoomVideoSDKUser* pUser) { if (pUser->GetSharePipe()) pUser->GetSharePipe()->unSubscribe(this); } ```