Skip to content

Commit

Permalink
Merge pull request #157 from aws-samples/development
Browse files Browse the repository at this point in the history
Fix for Chrome AudioContext initialization changes
  • Loading branch information
bobpskier authored Jun 17, 2019
2 parents d53aa7f + bc255f8 commit ba569ef
Show file tree
Hide file tree
Showing 13 changed files with 1,005 additions and 128 deletions.
2 changes: 1 addition & 1 deletion dist/lex-web-ui-loader.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lex-web-ui-loader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/lex-web-ui-mobile-hub.zip
Binary file not shown.
1,073 changes: 972 additions & 101 deletions dist/lex-web-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lex-web-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lex-web-ui.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/lex-web-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/wav-worker.min.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* lex-web-ui v"0.14.6"
* lex-web-ui v"0.14.7"
* (c) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Released under the Amazon Software License.
*/
Expand Down
2 changes: 1 addition & 1 deletion lex-web-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lex-web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lex-web-ui",
"version": "0.14.6",
"version": "0.14.7",
"description": "Amazon Lex Web Interface",
"author": "AWS",
"license": "Amazon Software License",
Expand Down Expand Up @@ -95,8 +95,8 @@
"worker-loader": "^1.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
"node": ">= 8.16.0",
"npm": ">= 6.4.1"
},
"browserslist": [
"> 1%",
Expand Down
28 changes: 17 additions & 11 deletions lex-web-ui/src/lib/lex/recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,27 @@ export default class {
this._isSilentRecording = true;
this._silentRecordingConsecutiveCount = 0;

// sets this._audioContext AudioContext object
return this._initAudioContext()
// inits AudioContext.createScriptProcessor object
// used to process mic audio input volume
// sets this._micVolumeProcessor
.then(() => this._initMicVolumeProcessor())
.then(() => this._initStream());
return Promise.resolve();
}

/**
* Start recording
*/
start() {
async start() {
if (this._state !== 'inactive' ||
typeof this._stream === 'undefined') {
console.warn('recorder start called out of state');
return;
if (this._state !== 'inactive') {
console.warn('invalid state to start recording');
return;
}
console.warn('initializing audiocontext after first user interaction - chrome fix');
await this._initAudioContext()
.then(() => this._initMicVolumeProcessor())
.then(() => this._initStream());
if (typeof this._stream === 'undefined') {
console.warn('failed to initialize audiocontext');
return;
}
}

this._state = 'recording';
Expand Down Expand Up @@ -436,7 +440,9 @@ export default class {
if (document.hidden) {
this._audioContext.suspend();
} else {
this._audioContext.resume();
this._audioContext.resume().then(() => {
console.info('Playback resumed successfully from visibility change');
});
}
});
return Promise.resolve();
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-lex-web-ui",
"version": "0.14.6",
"version": "0.14.7",
"description": "Sample Amazon Lex Web Interface",
"main": "dist/lex-web-ui.min.js",
"repository": {
Expand Down Expand Up @@ -58,8 +58,8 @@
"webpack-dev-server": "^2.10.1"
},
"engines": {
"node": ">= 8.1.2",
"npm": ">= 5.2.0"
"node": ">= 8.16.0",
"npm": ">= 6.4.1"
},
"browserslist": [
"> 1%",
Expand Down

0 comments on commit ba569ef

Please sign in to comment.