Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5456)

Unified Diff: chrome/browser/resources/hotword/state_manager.js

Issue 545373005: Play a chime when the hotword is triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Import chime from shared module. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/hotword/state_manager.js
diff --git a/chrome/browser/resources/hotword/state_manager.js b/chrome/browser/resources/hotword/state_manager.js
index 2727cbcd8af7cf76ee799f1d8790d071e2cc9d3a..764d2c099dd202f5b81f9d123d2a4195da6d1373 100644
--- a/chrome/browser/resources/hotword/state_manager.js
+++ b/chrome/browser/resources/hotword/state_manager.js
@@ -43,8 +43,19 @@ cr.define('hotword', function() {
*/
this.sessionStartedCb_ = null;
+ /**
+ * Hotword trigger audio notification... a.k.a The Chime (tm).
+ * @private {!Audio}
+ */
+ this.chime_ = document.createElement('audio');
+
// Get the initial status.
chrome.hotwordPrivate.getStatus(this.handleStatus_.bind(this));
+
+ // Setup the chime and insert into the page.
+ this.chime_.src = chrome.extension.getURL(
+ hotword.constants.SHARED_MODULE_ROOT + '/audio/chime.wav');
+ document.body.appendChild(this.chime_);
Dan Beam 2014/09/23 03:43:13 what happens if this fails to load?
Anand Mistry (off Chromium) 2014/09/24 01:35:02 There'll be a warning on the console for this exte
}
/**
@@ -227,6 +238,9 @@ cr.define('hotword', function() {
// Detector implicitly stops when the hotword is detected.
this.state_ = State_.STOPPED;
+ // Play the chime.
+ this.chime_.play();
Dan Beam 2014/09/23 03:43:13 can this handle being called before the sound stop
Anand Mistry (off Chromium) 2014/09/24 01:35:02 The sound is shorter than 1 second. I don't think
+
chrome.hotwordPrivate.notifyHotwordRecognition('search', function() {});
// Implicitly clear the session. A session needs to be started in order to
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698