Unable to init meeting

Is there any better way to fix this?

Thanks

Hi @saurabh,

We are working to fix this bug but right now the workaround would be to use the setTimeout method.

Thanks

I am facing an issue where when I use useEffect to join the meeting then, I am getting an error which i am consoling it in the terminal from the response coming in success attribute of init and join methods and the error is - “{method: “init”, status: false, errorCode: 3008, errorMessage: “Please init meeting first!”, result: null}”. This is coming in the success method of join method.
But the ZoomMtg.init function response is - “{method: “init”, status: true, errorCode: 0, errorMessage: null, result: null}”.
This error is not coming when I am not using useEffect to call the function.

const Meeting = (props) => {
    const getMeetingConfig = () => ({
        meetingNumber: parseInt(props.params.mn),
        apiKey: API_KEY,
        apiSecret: API_SECRET,
        role: 1,
        userName: 'Vk',
        passWord: props.params.pass,
        leaveUrl: '/zoom-poc',
        userEmail: ''
    })

    const createSignature = () => {    
        const meetingConfig = getMeetingConfig();
        ZoomMtg.generateSignature({
            meetingNumber: meetingConfig.meetingNumber,
            apiKey: meetingConfig.apiKey,
            apiSecret: meetingConfig.apiSecret,
            role: meetingConfig.role,
            success: (res) => {
                beginJoin(res.result)
            },
        });
    }

    const beginJoin = (signature) => {
        const meetingConfig = getMeetingConfig();

        ZoomMtg.init({
            leaveUrl: meetingConfig.leaveUrl,
            isSupportAV: true,
            success: (success) => {
                console.log(success)
                ZoomMtg.join({
                    meetingNumber: meetingConfig.meetingNumber,
                    userName: meetingConfig.userName,
                    signature,
                    apiKey: meetingConfig.apiKey,
                    userEmail: meetingConfig.userEmail,
                    passWord: meetingConfig.passWord,
                    success: (res) => {
                        console.log("join meeting success");
                    },
                    error: (res) => {
                        console.log(res);
                    },
                });
            },
            error: (res) => {
                console.log(res);
            },
        });
    }, 2000)
    };

    useEffect(() => {
        ZoomMtg.setZoomJSLib('https://source.zoom.us/1.8.5/lib', '/av');
        ZoomMtg.preLoadWasm();
        ZoomMtg.prepareJssdk();
        createSignature()
    }, [])

    return (
        <div id='zmmtg-root' />
    )
}

export default Meeting;

Hey @vk-jangid,

Thank you for reaching out to the Zoom Developer Forum. Please try moving the following lines to the top of the file so that we can ensure they are always set before any other code runs and the scope they reside in is available for all functions on the page.

        ZoomMtg.setZoomJSLib('https://source.zoom.us/1.8.5/lib', '/av');
        ZoomMtg.preLoadWasm();
        ZoomMtg.prepareJssdk();

If you’re looking for more detail on how this can be configured, please see our Sample Web App.

I hope that helps! Let me know if you have any questions.

Thanks,
Max

I am using the CDN way of implementing the zoom SDK, so I already tried what you are suggesting, but It throws an error saying that ZoomMtg is not defined.

Hey @vk-jangid,

Are you using a framework (Angular.js, Vue.js, React, etc.) when you’re getting this error? On that same note, are you using a JS bundler such as Webpack? If you’re able to provide a public git repo of the code that exhibits this issue, I’ll be sure to troubleshoot it more in-depth on my end.

Thanks,
Max