Index: openacs-4/packages/proctoring-support/www/resources/proctoring.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/proctoring-support/www/resources/proctoring.js,v diff -u -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/proctoring-support/www/resources/proctoring.js 7 Oct 2020 09:10:13 -0000 1.1.2.5 +++ openacs-4/packages/proctoring-support/www/resources/proctoring.js 7 Oct 2020 10:12:31 -0000 1.1.2.6 @@ -353,7 +353,7 @@ this.onMissingStreamHandler = conf.onMissingStreamHandler; this.onMicrophoneTooLowHandler = conf.onMicrophoneTooLowHandler; this.isMissingStreams = false; - this.streamErrors = ["", ""]; + this.streamErrors = [null, null]; this.gifs = [null, null]; this.imageHandlers = [null, null]; @@ -514,36 +514,38 @@ return muted; } - checkStream(stream, streamName) { - if (stream == null || - !stream.active || - this.streamMuted(stream)) { - if (this.mediaConf[streamName].required) { - return false; + checkStream(i) { + var stream = this.streams[i]; + var streamName = this.streamNames[i]; + var video = this.videos[i]; + + if (this.mediaConf[streamName].required) { + try { + if (this.streamErrors[i]) { + throw this.streamErrors[i]; + } else if (stream == null) { + throw "stream does not exist"; + } else if (!stream.active) { + throw "stream is not active"; + } else if (this.streamMuted(stream)) { + throw "stream is muted"; + } else if (this.ready && video.paused) { + throw "video acquisition appears to have stopped"; + } + } catch (e) { + this.isMissingStreams = true; + if (typeof this.onMissingStreamHandler == 'function') { + this.onMissingStreamHandler(streamName, e); + } } } - return true; } checkMissingStreams() { if (!this.isMissingStreams && this.numCheckedStreams == this.numStreams) { for (var i = 0; i < this.streams.length; i++) { - var streamName = this.streamNames[i]; - var video = this.videos[i]; - try { - if (!this.checkStream(this.streams[i], streamName)) { - throw this.streamErrors[i]; - } else if (this.ready && video.paused) { - throw "Video acquisition appears to have stopped."; - } - } catch (e) { - console.error(e); - this.isMissingStreams = true; - if (typeof this.onMissingStreamHandler == 'function') { - this.onMissingStreamHandler(streamName, e.message); - } - } + this.checkStream(i); } }