SEBWIN-475: Cleaned and updated Zoom proctoring implementation.

This commit is contained in:
Damian Büchel 2021-06-09 19:37:21 +02:00
parent 9252121b57
commit 5e03997049
3 changed files with 53 additions and 71 deletions

View file

@ -98,7 +98,7 @@ namespace SafeExamBrowser.Proctoring
{ {
start = !string.IsNullOrWhiteSpace(settings.Zoom.ApiKey); start = !string.IsNullOrWhiteSpace(settings.Zoom.ApiKey);
start &= !string.IsNullOrWhiteSpace(settings.Zoom.ApiSecret); start &= !string.IsNullOrWhiteSpace(settings.Zoom.ApiSecret);
start &= settings.Zoom.MeetingNumber != default(int); start &= !string.IsNullOrWhiteSpace(settings.Zoom.MeetingNumber);
start &= !string.IsNullOrWhiteSpace(settings.Zoom.UserName); start &= !string.IsNullOrWhiteSpace(settings.Zoom.UserName);
} }
@ -236,7 +236,7 @@ namespace SafeExamBrowser.Proctoring
{ {
html = html.Replace("%%_API_KEY_%%", settings.Zoom.ApiKey); html = html.Replace("%%_API_KEY_%%", settings.Zoom.ApiKey);
html = html.Replace("%%_API_SECRET_%%", settings.Zoom.ApiSecret); html = html.Replace("%%_API_SECRET_%%", settings.Zoom.ApiSecret);
html = html.Replace("123456789", Convert.ToString(settings.Zoom.MeetingNumber)); html = html.Replace("%%_MEETING_NUMBER_%%", settings.Zoom.MeetingNumber);
html = html.Replace("%%_USER_NAME_%%", settings.Zoom.UserName); html = html.Replace("%%_USER_NAME_%%", settings.Zoom.UserName);
} }

View file

@ -1,36 +1,31 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.8.1/css/bootstrap.css" /> <link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.9.1/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.8.1/css/react-select.css" /> <link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.9.1/css/react-select.css" />
</head> </head>
<body> <body>
<script src="https://source.zoom.us/1.8.1/lib/vendor/react.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/react.min.js"></script>
<script src="https://source.zoom.us/1.8.1/lib/vendor/react-dom.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/react-dom.min.js"></script>
<script src="https://source.zoom.us/1.8.1/lib/vendor/redux.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/redux.min.js"></script>
<script src="https://source.zoom.us/1.8.1/lib/vendor/redux-thunk.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/redux-thunk.min.js"></script>
<script src="https://source.zoom.us/1.8.1/lib/vendor/jquery.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/jquery.min.js"></script>
<script src="https://source.zoom.us/1.8.1/lib/vendor/lodash.min.js"></script> <script src="https://source.zoom.us/1.9.1/lib/vendor/lodash.min.js"></script>
<script src="https://source.zoom.us/zoom-meeting-1.8.1.min.js"></script> <script src="https://source.zoom.us/zoom-meeting-1.9.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
const API_KEY = "%%_API_KEY_%%"; const API_KEY = "%%_API_KEY_%%";
const API_SECRET = "%%_API_SECRET_%%"; const API_SECRET = "%%_API_SECRET_%%";
console.log("Checking system requirements..."); ZoomMtg.setZoomJSLib('https://source.zoom.us/1.9.1/lib', '/av');
console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));
console.log("Initializing Zoom...");
ZoomMtg.setZoomJSLib('https://source.zoom.us/1.8.1/lib', '/av');
ZoomMtg.preLoadWasm(); ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk(); ZoomMtg.prepareJssdk();
const config = { const config = {
meetingNumber: 123456789, meetingNumber: "%%_MEETING_NUMBER_%%",
leaveUrl: 'https://google.ch', leaveUrl: 'https://google.ch',
userName: '%%_USER_NAME_%%', userName: '%%_USER_NAME_%%',
/* passWord: 'password', // if required */ role: 0
role: 0 // 1 for host; 0 for attendee
}; };
const signature = ZoomMtg.generateSignature({ const signature = ZoomMtg.generateSignature({
@ -39,60 +34,49 @@
apiSecret: API_SECRET, apiSecret: API_SECRET,
role: config.role, role: config.role,
error: function (res) { error: function (res) {
console.error("FAILED TO GENERATE SIGNATURE: " + res) alert(`Failed to generate signature: ${res}`)
}, }
success: function (res) {
console.log("Successfully generated signature.");
console.log(res.result);
},
}); });
console.log("Initializing meeting...");
// See documentation: https://zoom.github.io/sample-app-web/ZoomMtg.html#init
ZoomMtg.init({ ZoomMtg.init({
debug: true, //optional leaveUrl: config.leaveUrl,
leaveUrl: config.leaveUrl, //required showMeetingHeader: true,
// webEndpoint: 'PSO web domain', // PSO option disableInvite: false,
showMeetingHeader: true, //option disableCallOut: false,
disableInvite: false, //optional disableRecord: false,
disableCallOut: false, //optional disableJoinAudio: false,
disableRecord: false, //optional audioPanelAlwaysOpen: true,
disableJoinAudio: false, //optional showPureSharingContent: false,
audioPanelAlwaysOpen: true, //optional isSupportAV: true,
showPureSharingContent: false, //optional isSupportChat: false,
isSupportAV: true, //optional, isSupportQA: true,
isSupportChat: false, //optional, isSupportCC: true,
isSupportQA: true, //optional, screenShare: true,
isSupportCC: true, //optional, videoDrag: true,
screenShare: true, //optional, sharingMode: 'both',
rwcBackup: '', //optional, videoHeader: true,
videoDrag: true, //optional, isLockBottom: true,
sharingMode: 'both', //optional, isSupportNonverbal: true,
videoHeader: true, //optional, isShowJoiningErrorDialog: true,
isLockBottom: true, // optional, inviteUrlFormat: '',
isSupportNonverbal: true, // optional, loginWindow: {
isShowJoiningErrorDialog: true, // optional,
inviteUrlFormat: '', // optional
loginWindow: { // optional,
width: 400, width: 400,
height: 380 height: 380
}, },
// meetingInfo: [ // optional meetingInfo: [
// 'topic', 'topic',
// 'host', 'host',
// 'mn', 'mn',
// 'pwd', 'pwd',
// 'telPwd', 'telPwd',
// 'invite', 'invite',
// 'participant', 'participant',
// 'dc' 'dc'
// ], ],
disableVoIP: false, // optional disableVoIP: false,
disableReport: false, // optional disableReport: false,
error: function (res) { error: function (res) {
console.warn("INIT ERROR") alert(`Failed to initialize meeting: ${res}`)
console.log(res)
}, },
success: function () { success: function () {
ZoomMtg.join({ ZoomMtg.join({
@ -100,10 +84,8 @@
apiKey: API_KEY, apiKey: API_KEY,
meetingNumber: config.meetingNumber, meetingNumber: config.meetingNumber,
userName: config.userName, userName: config.userName,
/* passWord: meetConfig.passWord, */ error: function (res) {
error(res) { alert(`Failed to join meeting: ${res}`)
console.warn("JOIN ERROR")
console.log(res)
} }
}) })
} }

View file

@ -34,7 +34,7 @@ namespace SafeExamBrowser.Settings.Proctoring
/// <summary> /// <summary>
/// The number of the meeting. /// The number of the meeting.
/// </summary> /// </summary>
public int MeetingNumber { get; set; } public string MeetingNumber { get; set; }
/// <summary> /// <summary>
/// The user name to be used for the meeting. /// The user name to be used for the meeting.