Skip to content

Commit

Permalink
fix: Camera accesss denied flow in monitorer
Browse files Browse the repository at this point in the history
  • Loading branch information
vdvibhu20 committed May 14, 2024
1 parent b42acc4 commit e2e3e31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/pods/components/intermediate-contest-view/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export default class IntermediateContestComponent extends Component {
@computed('monitorerError')
get monitorerErrorText() {
switch(this.monitorerError) {
case "CAMERAACCESSDENIED": return 'Please grant camera permissions to continue with test.'
case "CAMERAACCESSDENIED": return 'Please grant camera and mic permissions to continue with test.'
case "ACCESS_DENIED": return 'Please grant camera and mic permissions to continue with test.'
}
}

Expand Down Expand Up @@ -104,7 +105,7 @@ export default class IntermediateContestComponent extends Component {
}

@action promptCameraPermission() {
navigator.mediaDevices.getUserMedia ({video: true},
navigator.mediaDevices.getUserMedia ({video: true, mic: true},
// successCallback
function() {
this.set('monitorerError', '')
Expand Down
2 changes: 1 addition & 1 deletion app/pods/contests/contest/attempt/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class AttemptController extends Controller{
this.set('isMonitorerSet', false)

switch(detail.code) {
case "CAMERAACCESSDENIED":
case "ACCESS_DENIED":
this.transitionToRoute('contests.contest', this.contest.id, {
queryParams: {
monitorerError: detail.code
Expand Down
6 changes: 3 additions & 3 deletions app/services/monitorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ export default Service.extend({
},

async disable() {
this.set('contest', null)
this.set('onError', null)

// this.set('contest', null)
// this.set('onError', null)
await this.disableTabSwitchMonitorer()
await this.disableWindowResizeMonitorer()
await this.disableNoFaceMonitorer()
await this.disableMultipleFacesMonitorer()

window.removeEventListener('monitorerfault', this.monitorerFaultEventHandler)
},
Expand Down

0 comments on commit e2e3e31

Please sign in to comment.