Skip to content

Commit

Permalink
Add debug info to the NO_VOICE_SUPPORT message
Browse files Browse the repository at this point in the history
  • Loading branch information
annmirosh committed Nov 9, 2020
1 parent 93c9869 commit 07201e1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
47 changes: 46 additions & 1 deletion dist/alan_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ function alanBtn(options) {

// Error messages
var MIC_BLOCKED_MSG = 'Access to the microphone was blocked. Please allow it to use Alan';
var NO_VOICE_SUPPORT_IN_BROWSER_MSG = 'Your browser doesn’t support voice input. To use voice, open Alan Tutor in a Chrome, Safari, or Firefox desktop browser window.';
var NO_VOICE_SUPPORT_IN_BROWSER_MSG = 'Your browser doesn’t support voice input. To use voice, try it in the Chrome, Safari, or Firefox desktop browser window. If you think your browser supports voice input, please send the Debug info below to support@alan.app. ' + getDebugInfo();
var NOT_SECURE_ORIGIN_MSG = 'Audio is allowed only on the secure connection: make sure that your connection protocol is under https, file or http with localhost. Now you are running with "' + window.location.protocol + '" protocol and "' + window.location.hostname + '" hostname';
var LOW_VOLUME_MSG = 'Low volume level';
var OFFLINE_MSG = 'You\'re offline';
Expand Down Expand Up @@ -2386,6 +2386,51 @@ function alanBtn(options) {
return available;
}

function getDebugInfo() {
var info = '\nDebug Info:\n';

info += 'getUserMedia - ';
info += navigator.getUserMedia ? 'true' : 'false';
info += '\n';

info += 'mediaDevices.getUserMedia - ';
info += (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) ? 'true' : 'false';
info += '\n';

info += 'webkitGetUserMedia - ';
info += navigator.webkitGetUserMedia ? 'true' : 'false';
info += '\n';

info += 'mozGetUserMedia - ';
info += navigator.mozGetUserMedia ? 'true' : 'false';
info += '\n';

info += 'msGetUserMedia - ';
info += navigator.msGetUserMedia ? 'true' : 'false';
info += '\n';

info += 'AudioContext - ';
info += window.AudioContext ? 'true' : 'false';
info += '\n';

info += 'webkitAudioContext - ';
info += window.webkitAudioContext ? 'true' : 'false';
info += '\n';

info += 'mozAudioContext - ';
info += window.mozAudioContext ? 'true' : 'false';
info += '\n';

info += 'mobile - ';
info += /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
info += '\n';

info += 'userAgent - ';
info += navigator.userAgent;

return info;
}

//#endregion

//#region Append layers to the rootEl
Expand Down
2 changes: 1 addition & 1 deletion dist/alan_lib.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alan-ai/alan-sdk-web",
"version": "1.8.2",
"version": "1.8.3",
"description": "Alan Web SDK: a lightweight JavaScript library for adding a voice experience to your website or web application",
"keywords": [
"alan sdk web",
Expand Down

0 comments on commit 07201e1

Please sign in to comment.