使用Zoom Meeting SDK开发网页会议功能时遭遇'Uncaught TypeError: Cannot read properties of null (reading 'append')'错误求助
Zoom Meeting SDK开发网页会议功能时遭遇'Uncaught TypeError: Cannot read properties of null (reading 'append')'错误求助
我正在尝试用Zoom Meeting SDK开发一个纯前端的HTML+JS网站来加入会议,但刚接触这个SDK,一直遇到Uncaught TypeError: Cannot read properties of null (reading 'append')这个错误,实在搞不懂原因。目前我只做了前端部分,下面是出现的错误截图:

以下是我的代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Kiosk Video Call</title> <!-- Add Lodash before Zoom SDK --> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script> <!-- Load Zoom SDK Dependencies --> <script src="https://source.zoom.us/2.15.0/lib/vendor/react.min.js"></script> <script src="https://source.zoom.us/2.15.0/lib/vendor/react-dom.min.js"></script> <script src="https://source.zoom.us/2.15.0/lib/vendor/redux.min.js"></script> <script src="https://source.zoom.us/2.15.0/lib/vendor/redux-thunk.min.js"></script> <script src="https://source.zoom.us/2.15.0/zoom-meeting-2.15.0.min.js"></script> <style> /* Ensure Zoom Meeting UI is properly displayed */ #zmmtg-root { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; background-color: white; } .meeting-app { display: none; } body { text-align: center; font-family: Arial, sans-serif; } .btn { background-color: #007bff; border: none; color: white; padding: 15px 32px; font-size: 16px; cursor: pointer; margin-top: 20px; } .input-field { margin: 10px; padding: 8px; width: 80%; max-width: 400px; display: block; } </style> </head> <body> <h1>Test Video Call</h1> <div id="zmmtg-root"></div> <div id="aria-notify-area"></div> <div class="meeting-app"></div> <input id="meetingNumber" class="input-field" type="text" placeholder="Enter Meeting Number"> <input id="passWord" class="input-field" type="text" placeholder="Enter Meeting Password"> <input id="userName" class="input-field" type="text" placeholder="Enter Your Name" value="Kiosk Client"> <input id="apiKey" class="input-field" type="text" placeholder="Enter API Key"> <input id="signature" class="input-field" type="text" placeholder="Enter Signature"> <button id="startSession" class="btn">Start Session</button> </body> <script> document.addEventListener('DOMContentLoaded', function() { console.log("Checking if ZoomMtg is loaded..."); if (typeof ZoomMtg === "undefined") { console.error("Zoom SDK failed to load. Check network connection or script URL."); return; } console.log("Zoom SDK Loaded Successfully"); // Initialize Zoom SDK ZoomMtg.setZoomJSLib("https://source.zoom.us/2.15.0/lib", "/av"); ZoomMtg.preLoadWasm(); ZoomMtg.prepareWebSDK(); ZoomMtg.i18n.load('en-US'); ZoomMtg.i18n.reload('en-US'); document.getElementById("startSession").addEventListener("click", function () { console.log("Start Session button clicked."); // Show Zoom Meeting Container document.getElementById('zmmtg-root').style.display = 'block'; // Get User Inputs const meetingNumber = document.getElementById("meetingNumber").value.trim(); const passWord = document.getElementById("passWord").value.trim(); const userName = document.getElementById("userName").value.trim(); const apiKey = document.getElementById("apiKey").value.trim(); const signature = document.getElementById("signature").value.trim(); if (!meetingNumber || !passWord || !userName || !apiKey || !signature) { alert("Please fill in all fields before starting the session."); return; } console.log("Initializing Zoom SDK..."); ZoomMtg.init({ leaveUrl: window.location.origin + window.location.pathname, isSupportAV: true, disableInvite: true, success: function () { console.log("Zoom SDK Initialized."); ZoomMtg.join({ meetingNumber: meetingNumber, userName: userName, signature: signature, apiKey: apiKey, passWord: passWord, success: function () { console.log("Joined Meeting Successfully!"); }, error: function (error) { console.error("Zoom Join Error:", error); document.getElementById('zmmtg-root').style.display = 'none'; }, }); }, error: function (error) { console.error("Zoom Init Error:", error); document.getElementById('zmmtg-root').style.display = 'none'; }, }); }); }); </script> </html>
备注:内容来源于stack exchange,提问作者Danish Ghazi
相关产品推荐
相关产品推荐

