Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectable audio input device #3079

Merged
merged 36 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2f930f8
Bump versions
compulim Apr 2, 2020
73e745c
Select audo input device
compulim Apr 3, 2020
e6f63f7
Clean up
compulim Apr 3, 2020
df688cb
Detect Web Audio support
compulim Apr 3, 2020
d5ecafc
Add sample
compulim Apr 3, 2020
c5b0060
Converge version of Carbon SDK
compulim Apr 3, 2020
cd4818c
Add entry
compulim Apr 3, 2020
64dc813
Add and update entries
compulim Apr 4, 2020
eb02ce7
Skip warning if AudioConfig is presented
compulim Apr 4, 2020
efcab95
Add test
compulim Apr 5, 2020
bbdc5d0
Add tests
compulim Apr 5, 2020
855b81d
Add authorization token from webchat-waterbottle
compulim Apr 5, 2020
4b89590
Enable IE11
compulim Apr 5, 2020
0a473e2
Add notes
compulim Apr 5, 2020
ec6368f
Use daily build
compulim Apr 5, 2020
c2dabcf
Use daily build
compulim Apr 5, 2020
3a7cdc9
Clean up
compulim Apr 6, 2020
f731659
Apply suggestions from code review
compulim Apr 6, 2020
7adabcb
Support Direct Line Speech
compulim Apr 6, 2020
cb37789
Add Direct Line Speech test
compulim Apr 8, 2020
160bc57
Add Direct Line Speech test
compulim Apr 8, 2020
b6ede18
Fix Direct Line Speech tests
compulim Apr 8, 2020
4fbe566
Improve test reliability
compulim Apr 8, 2020
a85c941
Save WAV files for failures
compulim Apr 8, 2020
2c67821
Add message
compulim Apr 8, 2020
ba02bee
Use mockbot-streaming token
compulim Apr 8, 2020
cb71884
Improve reliability
compulim Apr 8, 2020
9b7df11
Test reliability
compulim Apr 8, 2020
ffcf7ca
Remove buffer bar
compulim Apr 8, 2020
6368512
Remove commented out code
compulim Apr 9, 2020
e2c0dbb
Add Direct Line Speech
compulim Apr 9, 2020
6c1e091
Apply suggestions from code review
compulim Apr 15, 2020
30ccc2d
Apply PR suggestions
compulim Apr 20, 2020
35aee3c
Update entry
compulim Apr 21, 2020
5288298
Include @babel/plugin-proposal-class-properties
compulim Apr 22, 2020
6da8fa8
Fix tests
compulim Apr 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/__tests__/__image_snapshots__/**/__diff_output__
/.env
/coverage
/debug.log
/gh-pages
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Resolves [#2897](https://github.com/microsoft/BotFramework-WebChat/issues/2897). Moved from JUnit to VSTest reporter with file attachments, by [@compulim](https://github.com/compulim) in PR [#2990](https://github.com/microsoft/BotFramework-WebChat/pull/2990)
- Added `aria-label` attribute support for default Markdown engine, by [@patniko](https://github.com/patniko) in PR [#3022](https://github.com/microsoft/BotFramework-WebChat/pull/3022)
- Resolves [#2969](https://github.com/microsoft/BotFramework-WebChat/issues/2969). Support sovereign cloud for Cognitive Services Speech Services, by [@compulim](https://github.com/compulim) in PR [#3040](https://github.com/microsoft/BotFramework-WebChat/pull/3040)
- Resolves [#2481](https://github.com/microsoft/BotFramework-WebChat/issues/2481). Support selecting different audio input devices for Cognitive Services Speech Services, by [@compulim](https://github.com/compulim) in PR [#3079](https://github.com/microsoft/BotFramework-WebChat/pull/3079)

### Fixed

Expand All @@ -43,6 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes [#3074](https://github.com/microsoft/BotFramework-WebChat/issues/3074). Keep `props.locale` when sending to the bot, by [@compulim](https://github.com/compulim) in PR [#3095](https://github.com/microsoft/BotFramework-WebChat/issue/3095)
- Fixes [#3096](https://github.com/microsoft/BotFramework-WebChat/issues/3096). Use `<ScreenReaderText>` instead of `aria-label` for message bubbles, by [@compulim](https://github.com/compulim) in PR [#3097](https://github.com/microsoft/BotFramework-WebChat/issue/3097)
- Fixes [#2876](https://github.com/microsoft/BotFramework-WebChat/issues/2876). `messageBack` and `postBack` should send even if both `text` and `value` is falsy or `undefined`, by [@compulim](https://github.com/compulim) in PR [#3120](https://github.com/microsoft/BotFramework-WebChat/issues/3120)
- Fixes [#2668](https://github.com/microsoft/BotFramework-WebChat/issues/2668). Disable Web Audio on insecure connections, by [@compulim](https://github.com/compulim) in PR [#3079](https://github.com/microsoft/BotFramework-WebChat/issue/3079)

### Changed

Expand Down Expand Up @@ -102,11 +104,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [`core-js@3.6.4`](https://npmjs.com/package/core-js)
- Bumped Chrome Docker image to `3.141.59-zirconium` (Chrome 80.0.3987.106), by [@compulim](https://github.com/compulim) in PR [#2992](https://github.com/microsoft/BotFramework-WebChat/pull/2992)
- Added `4.8.0` to `embed/servicingPlan.json`, by [@compulim](https://github.com/compulim) in PR [#2986](https://github.com/microsoft/BotFramework-WebChat/pull/2986)
- Bumped `microsoft-cognitiveservices-speech-sdk@1.10.1` and `web-speech-cognitive-services@6.1.0`, by [@compulim](https://github.com/compulim) in PR [#3040](https://github.com/BotFramework-WebChat/pull/3040)
- Bumped `microsoft-cognitiveservices-speech-sdk@1.10.1` and `web-speech-cognitive-services@6.1.0`, by [@compulim](https://github.com/compulim) in PR [#3040](https://github.com/microsoft/BotFramework-WebChat/pull/3040)
- Resolved [#2886](https://github.com/microsoft/BotFramework-WebChat/issues/2886) and [#2987](https://github.com/microsoft/BotFramework-WebChat/issue/2987), converged all references of [`microsoft-cognitiveservices-speech-sdk`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk) to reduce footprint, by [@compulim](https://github.com/compulim) in PR [#3079](https://github.com/microsoft/BotFramework-WebChat/pull/3079)

## Samples

- Resolves [#2806](https://github.com/microsoft/BotFramework-WebChat/issues/2806), added [Single sign-on with On Behalf Of Token Authentication](https://webchat-sample-obo.azurewebsites.net/) sample, by [@tdurnford](https://github.com/tdurnford) in [#2865](https://github.com/microsoft/BotFramework-WebChat/pull/2865)
- Resolves [#2481](https://github.com/microsoft/BotFramework-WebChat/issues/2481), added selectable audio input device sample, by [@compulim](https://github.com/compulim) in PR [#3079](https://github.com/microsoft/BotFramework-WebChat/pull/3079)

## [4.8.0] - 2020-03-05

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fetch from 'node-fetch';

export default async function fetchSpeechServicesAuthorizationToken({ region, subscriptionKey, tokenURL }) {
if (!region && !tokenURL) {
throw new Error('Either "region" or "tokenURL" must be specified.');
} else if (region && tokenURL) {
throw new Error('Only either "region" or "tokenURL" can be specified.');
} else if (!subscriptionKey) {
throw new Error('"subscriptionKey" must be specified.');
}

const res = await fetch(tokenURL || `https://${region}.api.cognitive.microsoft.com/sts/v1.0/issueToken`, {
headers: {
'Ocp-Apim-Subscription-Key': subscriptionKey
},
method: 'POST'
});

if (!res.ok) {
throw new Error(`Failed to fetch authorization token, server returned ${res.status}`);
}

return await res.text();
}
26 changes: 19 additions & 7 deletions __tests__/html/__jest__/runPageProcessor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { join } from 'path';
import { promisify } from 'util';
import { tmpdir } from 'os';
import createDeferred from 'p-defer';
import fs from 'fs';

import { imageSnapshotOptions } from '../../constants.json';
import createJobObservable from './createJobObservable';
Expand All @@ -9,6 +12,8 @@ const customImageSnapshotOptions = {
customSnapshotsDir: join(__dirname, '../../__image_snapshots__/html')
};

const writeFile = promisify(fs.writeFile);

export default async function runPageProcessor(driver, { ignoreConsoleError = false, ignorePageError = false } = {}) {
const webChatLoaded = await driver.executeScript(() => !!window.WebChat);
const webChatTestLoaded = await driver.executeScript(() => !!window.WebChatTest);
Expand Down Expand Up @@ -51,18 +56,25 @@ export default async function runPageProcessor(driver, { ignoreConsoleError = fa
},
next: async ({ deferred, job }) => {
try {
let result;

if (job.type === 'snapshot') {
try {
expect(await driver.takeScreenshot()).toMatchImageSnapshot(customImageSnapshotOptions);
deferred.resolve();
} catch (err) {
pageResultDeferred.reject(err);
deferred.reject(err);
}
expect(await driver.takeScreenshot()).toMatchImageSnapshot(customImageSnapshotOptions);
} else if (job.type === 'save file') {
const filename = join(tmpdir(), `${Date.now()}-${job.payload.filename}`);

await writeFile(filename, Buffer.from(job.payload.base64, 'base64'));

console.log(`Saved to ${filename}`);

result = filename;
} else {
throw new Error(`Unknown job type "${job.type}".`);
}

deferred.resolve(result);
} catch (err) {
pageResultDeferred.reject(err);
deferred.reject(err);
}
}
Expand Down
28 changes: 13 additions & 15 deletions __tests__/html/__jest__/setupRunHTMLTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,22 @@ global.runHTMLTest = async (
const params = parseURLParams(new URL(url, 'http://webchat2/').hash);

try {
// For unknown reason, if we use ?wd=1, it will be removed.
// But when we use #wd=1, it kept.
// We are only parsing the "hash" from "url", the "http://localhost/" is actually ignored.
let { hash } = new URL(url, 'http://localhost/');

if (global.docker) {
params.wd = 1;
if (hash) {
hash += '&wd=1';
} else {
hash = '#wd=1';
}

const baseURL = global.docker
? new URL(url, 'http://webchat2/')
: new URL(url, `http://localhost:${global.webServerPort}/`);

const hash =
'#' +
Object.entries(params)
.map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`)
.join('&');

await driver.get(new URL(hash, baseURL));
// For unknown reason, if we use ?wd=1, it will be removed.
// But when we use #wd=1, it kept.
await driver.get(
global.docker
? new URL(hash, new URL(url, 'http://webchat2/'))
: new URL(url, `http://localhost:${global.webServerPort}/`)
);

await runPageProcessor(driver, { ignoreConsoleError, ignorePageError });

Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.fatalError.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<div id="webchat"></div>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
corinagum marked this conversation as resolved.
Show resolved Hide resolved
const { conditions, createStore, host, pageObjects, shareObservable, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.firstConnect.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, shareObservable, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.invalidCredentials.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<div id="webchat"></div>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, timeouts } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.networkInterrupt.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, shareObservable, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.sendFailed.noAck.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, shareObservable, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.sendFailed.notSend.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.slowNetwork.firstConnect.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, updateIn, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/html/offlineUI.slowNetwork.reconnect.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="webchat"></div>
<script crossorigin="anonymous" src="https://unpkg.com/lolex@4/lolex.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
<script type="text/babel" data-presets="es2015,stage-3">
<script type="text/babel" data-presets="env,stage-3">
const { conditions, createStore, host, pageObjects, shareObservable, timeouts, token } = window.WebChatTest;

(async function() {
Expand Down
Loading