Camera don’t starts and we get the error - {type: 'INVALID_OPERATION', reason: 'Camera is starting,please wait.'}

Description
Thanks for the nice SDK.
After successful Client.join, we try to start the camera. But we get the error.
The screen does not work after waiting.

I would appreciate it if you could tell me the cause of the error and how to solve it.

Browser Console Error
{type: 'INVALID_OPERATION', reason: 'Camera is starting, please wait.'}

Which Web Video SDK version?
ver.1.8.5

Device

  • Device: Macbook Pro
  • OS: macOs Ventura: ver. 13.2 (22D49)
  • Browser: google chrome: ver.115.0.5790.170 (Official Build) (arm64)
  • Camera Model: Built-in Mac camera

Environment

  • Next.js: ver.13
  • Nest.js: ver.7

Video SDK Code Snippets

function Meeting() {
    useEffect(()=> {
        const fetch = async () => {
            const VideoSDK=await (await import('@zoom/videosdk')).default;

            let payload = router.query;
            payload.password = 'dip123';

            const {data} = await axios({
                url: 'api/zoom',
                method: 'post',
                data:payload,
            }).then((response)=>{
                return response;
            }).catch((error) => {
                return error;
            })

            let client = VideoSDK.createClient();
            client.init('en-US');

            let selfView=document.getElementById('self-view');
            let participantC = document.getElementById('participant-c');
     client.join(payload.topic,data.sessionToken,payload.username,payload.password).then(response=>{
                let stream = client.getMediaStream();

                stream.startVideo({
                    videoElement:selfView
                }).then(response=>{
                    stream.renderVideo(selfView, client.getCurrentUserInfo().userId, 540, 540).then(response=>{
                        console.log('-- current user is joined --> ', client.getCurrentUserInfo().userId);
                    }).catch(error=>{
                        console.log('-- self view renderer error -> ', error);
                    })

                    client.getAllUser().forEach(user=>{
                        stream.renderVideo(participantC,user.userId,540,540,0,0,2).then(response=>{
                            console.log('-- user joined -->' ,payload[0].user);
                        }).catch(error=>{
                            console.log('-- error while user-added video renderer -->' ,error);
                        })
                    })
                    BindEvents(stream);
                }).catch(error=>{
                    console.log('-- start video error --> ', error);
                })

                function BindEvents(stream) {
                    client.on('user-added',(payload)=>{
                        stream.renderVideo(participantC,payload[0].userId,540,540,0,0,2).then(response=>{
                            console.log('-- user joined -->', payload[0].user);
                        }).catch(error=>{
                            console.log('-- error while user-added video rendered --> ', error);
                        })
                    })
                }

                console.log(stream, "stream");

            }).catch(error=>{
                console.log('-- error while joining -->', error);
            })


        }
        fetch();
    },[]);

    return (<Fragment>
        <div id="room" className={ZoomStyles.room}>
            <video id={'self-view'} className={ZoomStyles.selfView}></video>
            <canvas id={'participant-c'} className={ZoomStyles.participantsC}></canvas>
        </div>
    </Fragment>);
}

Meeting.displayName='Meeting';
export default Meeting;

Additional context
The response after Client.join is as follows.

{
"audioConnectionStatus":0,
"bAllowISORecord":false,
"bCCEditor":false,
"bCanPinMultiVideo":false,
"bCapsPinMultiVideo":false,
"isRequestLT":false,
"isGuest":false,
"bHold":false,
"bMultiStreamVideoUser":false,
"bNDIBroadcast":false,
"bPrivateChatMsgDisabled":false,
"bRaiseHand":false,
"canRecord":0,
"caps":1310976,
"displayName":"dip",
"userId":16780288,
"nSkinTone":1,
"os":7,
"userRole":0,"
isHost":false,
"strConfUserID":"38MUO3PuQkyrcRNuSgqtwQ",
"userType":9,
"uniqueIndex":1,
"uniqueUserID":3,
"userGUID":"CCC63D81-F00D-C92F-890F-46BCCE4EE645",
"zoomID":"zMY9gfANyS-JD0a8zk7mRQ",
"action":2,
"audio":"",
"bAudioUnencrytped":false,
"muted":false,
"nFECC":0,
"nFECCExecutive":16780290,
"bVideoConnect":true,
"bVideoOn":false
} 

Hey @tatumistudio

Thanks for your feedback.

It will take a little longer when starting the video for the first time, the start time depends on the camera model.

We recommend waiting for the stream.startVideo method to get resolved before calling it again. Otherwise, the “{type: ‘INVALID_OPERATION’, reason: ‘Camera is starting, please wait.’}” error occurs.

Thanks
Vic

1 Like

Hi @vic.yang

Thanks for your help!

I will try it.
If that doesn’t solve the problem, I’ll ask again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.