# UnmuteVideo and videoHelper-\>subscribe() Not working together from the same main thread

**URL:** <https://devforum.zoom.us/t/unmutevideo-and-videohelper-subscribe-not-working-together-from-the-same-main-thread/118790>\
**Category:** Meeting SDK\
**Created:** [October 9, 2024, 9:45am UTC](https://devforum.zoom.us/t/unmutevideo-and-videohelper-subscribe-not-working-together-from-the-same-main-thread/118790 "2024-10-09T09:45:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gofmannir](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gofmannir/32/56746_2.png) [@gofmannir](https://devforum.zoom.us/u/gofmannir)\
**Post date:** [October 9, 2024, 9:45am UTC](https://devforum.zoom.us/t/unmutevideo-and-videohelper-subscribe-not-working-together-from-the-same-main-thread/118790/1 "2024-10-09T09:45:43Z")

</div>

**Meeting SDK Type and Version**  
MeetingSDK for linux version: v6.2.3.2095

**Description**  
I have a zoom bot that successfully join a meeting. it requests for recording permissions from the host, and starts raw recording with the “subscribe” method.  
I want also to send raw video to the bot’s stream.  
The raw recording and the raw sending works great separately, but they don’t work together at all.

Here is what I do: (based on the sample repo)

```auto
void onInMeeting() {
	printf("onInMeeting Invoked\n");

	//double check if you are in a meeting
	if (m_pMeetingService->GetMeetingStatus() == ZOOM_SDK_NAMESPACE::MEETING_STATUS_INMEETING) {
		printf("In Meeting Now...\n");

		//print all list of participants
		IList<unsigned int>* participants = m_pMeetingService->GetMeetingParticipantsController()->GetParticipantsList();
		printf("Participants count: %d\n", participants->GetCount());
	}
    printf("Requesting local recording permissions\n");

    SDKError aisSupported = m_pRecordController->IsSupportRequestLocalRecordingPrivilege();
    std::cout << "IsSupportRequestLocalRecordingPrivilege : = " << aisSupported << std::endl;

    m_pRecordController->RequestLocalRecordingPrivilege();
}

//callback when given recording permission
void onIsGivenRecordingPermission() {
    std::cout << "Is given recording permissions now..." << std::endl;
   RawSendingBotVideo();
    SDKError CanStartRawRecording = m_pRecordController->CanStartRawRecording();
    std::cout << "CanStartRawRecording : = " << CanStartRawRecording << std::endl;
    while(CanStartRawRecording != 0){
        CanStartRawRecording = m_pRecordController->CanStartRawRecording();
        std::cout << "CanStartRawRecording : = " << CanStartRawRecording << std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
    std::cout << "Calling SetupRawRecording() " << std::endl;

    m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
    SDKError err2 = m_pMeetingService->GetMeetingRecordingController()->CanStartRawRecording();

    if (err2 != SDKERR_SUCCESS) {
        std::cout << "Error occurred starting raw recording" << std::endl;
        my_handler(0);
    }

    SDKError err1 = m_pRecordController->StartRawRecording();
}

void RawSendingBotVideo(){
    ZoomSDKVideoSource* virtual_camera_video_source = new ZoomSDKVideoSource(DEFAULT_VIDEO_SOURCE);
    IZoomSDKVideoSourceHelper* p_videoSourceHelper = GetRawdataVideoSourceHelper();

    SDKError err = p_videoSourceHelper->setExternalVideoSource(virtual_camera_video_source);

    IMeetingVideoController* meetingController = m_pMeetingService->GetMeetingVideoController();
    SDKError err = meetingController->UnmuteVideo();
    while(err != SDKERR_SUCCESS){
        printf(" meetingController->UnmuteVideo(): Failed, error code: %d\n", err);
        std::this_thread::sleep_for(std::chrono::seconds(5));

        err = meetingController->UnmuteVideo();
        if (err != SDKERR_SUCCESS) {
            printf(" meetingController->UnmuteVideo(): Failed, error code: %d\n", err);
        }else{
            printf("meetingController->UnmuteVideo() success \n");
        }
    }
}

```

```auto
// Set the event listener for recording privilege status
	m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
	m_pRecordController->SetEvent(new MeetingRecordingCtrlEventListener(&onIsGivenRecordingPermission));

```

I notied that only once the code hit `m_pRecordController->StartRawRecording();` The bot video stream really starts.

This code works great, I’m getting the video sending capabilities, and I’m sending raw video frames with Libav.

Once I change the callback code a little bit and want to subscribe to a participant’s video stream, the bot not sending video anymore, just a black screen, the video source class `ZoomSDKVideoSource::onInitialize` method not called.

**Error?**  
The bot sending video is black with participant’s video stream subscribe.

cc @chunsiong.zoom @donte.zoom

---

<div class="post-metadata">

**Author:** ![gofmannir](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gofmannir/32/56746_2.png) [@gofmannir](https://devforum.zoom.us/u/gofmannir)\
**Post date:** [October 13, 2024, 8:05am UTC](https://devforum.zoom.us/t/unmutevideo-and-videohelper-subscribe-not-working-together-from-the-same-main-thread/118790/2 "2024-10-13T08:05:34Z")

</div>

Solved by not blocking the main loop.
