In the interest of moving things along for everyone I’m posting my sample code (HTML& PHP). Just save this as a .php file and put it on a server that can run PHP to test it. This code is what SHOULD be in the documentation so people don’t even have to mess with installing a node package or piecing together something usable from the documentation for a CDN implementation. I’ve replaced all the parts (like api secret, meeting number, etc) that people need to replace with their own data with the word REMOVED. There are 5 instances, one being a password so note that if you use this and setup a meeting or webinar that has no password. Please post your results or let me know what I’ve done wrong here.
<?php
date_default_timezone_set('UTC');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$api_secret = 'REMOVED';
function generate_signature($api_key, $api_secret, $meeting_number, $role) {
$time = time() * 1000 - 30000; //time in milliseconds (or close enough)
$data = base64_encode($api_key . $meeting_number . $time . $role);
$hash = hash_hmac('sha256', $data, $api_secret, true);
$_sig = $api_key . "." . $meeting_number . "." . $time . "." . $role . "." . base64_encode($hash);
//return signature, url safe base64 encoded
return rtrim(strtr(base64_encode($_sig), '+/', '-_'), '=');
}
$response = generate_signature($_POST['api_key'], $api_secret, $POST['meeting_number'], $POST['role']);
header('Content-type: application/json');
exit(json_encode($response));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title></title>
<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.7.7/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.7.7/css/react-select.css" />
<script src="https://source.zoom.us/1.7.7/lib/vendor/react.min.js"></script>
<script src="https://source.zoom.us/1.7.7/lib/vendor/react-dom.min.js"></script>
<script src="https://source.zoom.us/1.7.7/lib/vendor/redux.min.js"></script>
<script src="https://source.zoom.us/1.7.7/lib/vendor/redux-thunk.min.js"></script>
<script src="https://source.zoom.us/1.7.7/lib/vendor/jquery.min.js"></script>
<script src="https://source.zoom.us/1.7.7/lib/vendor/lodash.min.js"></script>
</head>
<body>
<!-- must put this in the body -->
<script src="https://source.zoom.us/zoom-meeting-1.7.7.min.js"></script>
<script>
console.log('checkSystemRequirements');
console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));
ZoomMtg.setZoomJSLib('https://dmogdx0jrul3u.cloudfront.net/1.7.7/lib', '/av');
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();
var meetConfig = {
apiKey: 'REMOVED', // ZOOM ESSENTIAL GUIDE IS MISSING THE COMMA AT THE END OF THE LINE
meetingNumber: 'REMOVED ',
leaveUrl: 'REMOVED',
userName: 'Firstname Lastname',
userEmail: 'firstname.lastname@yoursite.com', // required for webinar
passWord: 'REMOVED', // if required
role: 0 // 1 for host; 0 for attendee or webinar
};
$.ajax({
type: 'POST',
timeout: 30000,
url: '<?php echo $_SERVER['PHP_SELF']; ?>',
dataType: 'json',
data: 'api_key=' + meetConfig.apiKey + '&meeting_number=' + meetConfig.meetingNumber + '&role=' + meetConfig.role
})
.done(function(data) {
// for debug
console.log('signature: ' + data);
ZoomMtg.init({
leaveUrl: meetConfig.leaveUrl,
debug: true,
success: function() {
ZoomMtg.join({
signature: data,
apiKey: meetConfig.apiKey,
meetingNumber: meetConfig.meetingNumber,
userName: meetConfig.userName,
// Email required for Webinars
userEmail: meetConfig.userEmail,
// password optional; set by Host
passWord: meetConfig.passWord, // ZOOM ESSENTIAL GUIDE HAS password: without the capital W AND IS MISSING THE COMMA AT THE END OF THE LINE
error: function(res){
console.log(res)
}
});
},
error: function() {
console.log('init error');
}
});
});
</script>
</body>
</html>