| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | |
| 2 1) The <head> information in this page is significant, should be uniform | |
| 3 across api docs and should be edited only with knowledge of the | |
| 4 templating mechanism. | |
| 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | |
| 6 browser, it will be re-generated from the template, json schema and | |
| 7 authored overview content. | |
| 8 4) The <body>.innerHTML is also generated by an offline step so that this | |
| 9 page may easily be indexed by search engines. | |
| 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | |
| 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | |
| 13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> | |
| 14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js"> | |
| 15 </script> | |
| 16 <script type="text/javascript" src="../../../../third_party/json_minify/mini
fy-sans-regexp.js"> | |
| 17 </script> | |
| 18 <script type="text/javascript" src="js/api_page_generator.js"></script> | |
| 19 <script type="text/javascript" src="js/bootstrap.js"></script> | |
| 20 <script type="text/javascript" src="js/sidebar.js"></script> | |
| 21 <meta name="description" content="Documentation for the chrome.experimental.sp
eechInput module, which is part of the Google Chrome extension APIs."><title>Sp
eech Input API - Google Chrome Extensions - Google Code</title></head> | |
| 22 <body> <div id="devModeWarning" class="displayModeWarning"> | |
| 23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp
ecting to see local changes when you refresh? You'll need run chrome with --allo
w-file-access-from-files. | |
| 24 </div> | |
| 25 <div id="branchWarning" class="displayModeWarning"> | |
| 26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation. | |
| 27 It may not work with the stable release of Chrome.</span> | |
| 28 <select id="branchChooser"> | |
| 29 <option>Choose a different version... | |
| 30 </option><option value="">Stable | |
| 31 </option><option value="beta">Beta | |
| 32 </option><option value="dev">Dev | |
| 33 </option><option value="trunk">Trunk | |
| 34 </option></select> | |
| 35 </div> | |
| 36 <div id="unofficialWarning" class="displayModeWarning"> | |
| 37 <span>WARNING: This is unofficial documentation. It may not work with the | |
| 38 current release of Chrome.</span> | |
| 39 <button id="goToOfficialDocs">Go to the official docs</button> | |
| 40 </div> | |
| 41 <div id="gc-container" class="labs"> | |
| 42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> | |
| 43 <!-- In particular, sub-templates that recurse, must be used by allowing | |
| 44 jstemplate to make a copy of the template in this section which | |
| 45 are not operated on by way of the jsskip="true" --> | |
| 46 <!-- /SUBTEMPLATES --> | |
| 47 <a id="top"></a> | |
| 48 <div id="skipto"> | |
| 49 <a href="#gc-pagecontent">Skip to page content</a> | |
| 50 <a href="#gc-toc">Skip to main navigation</a> | |
| 51 </div> | |
| 52 <!-- API HEADER --> | |
| 53 <table id="header" width="100%" cellspacing="0" border="0"> | |
| 54 <tbody><tr> | |
| 55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c
ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:
0; margin:0;"></a></td> | |
| 56 <td valign="middle" width="100%" style="padding-left:0.6em;"> | |
| 57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.
5em"> | |
| 58 <div id="gsc-search-box"> | |
| 59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz
fqtno"> | |
| 60 <input type="hidden" name="ie" value="UTF-8"> | |
| 61 <input type="text" name="q" value="" size="55"> | |
| 62 <input class="gsc-search-button" type="submit" name="sa" value="Se
arch"> | |
| 63 <br> | |
| 64 <span class="greytext">e.g. "page action" or "tabs"</span> | |
| 65 </div> | |
| 66 </form> | |
| 67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc
ript> | |
| 68 <script type="text/javascript">google.load("elements", "1", {packages:
"transliteration"});</script> | |
| 69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1
3n?form=cse&t13n_langs=en"></script> | |
| 70 <script type="text/javascript" src="https://www.google.com/coop/cse/br
and?form=cse&lang=en"></script> | |
| 71 </td> | |
| 72 </tr> | |
| 73 </tbody></table> | |
| 74 <div id="codesiteContent" class=""> | |
| 75 <a id="gc-topnav-anchor"></a> | |
| 76 <div id="gc-topnav"> | |
| 77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab
s</a>)</h1> | |
| 78 <ul id="home" class="gc-topnav-tabs"> | |
| 79 <li id="home_link"> | |
| 80 <a href="index.html" title="Google Chrome Extensions home page">Home
</a> | |
| 81 </li> | |
| 82 <li id="docs_link"> | |
| 83 <a href="docs.html" title="Official Google Chrome Extensions documen
tation">Docs</a> | |
| 84 </li> | |
| 85 <li id="faq_link"> | |
| 86 <a href="faq.html" title="Answers to frequently asked questions abou
t Google Chrome Extensions">FAQ</a> | |
| 87 </li> | |
| 88 <li id="samples_link"> | |
| 89 <a href="samples.html" title="Sample extensions (with source code)">
Samples</a> | |
| 90 </li> | |
| 91 <li id="group_link"> | |
| 92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte
nsions" title="Google Chrome Extensions developer forum">Group</a> | |
| 93 </li> | |
| 94 <li id="so_link"> | |
| 95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext
ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a> | |
| 96 </li> | |
| 97 </ul> | |
| 98 </div> <!-- end gc-topnav --> | |
| 99 <div class="g-section g-tpl-170"> | |
| 100 <!-- SIDENAV --> | |
| 101 <div class="g-unit g-first" id="gc-toc"> | |
| 102 <ul> | |
| 103 <li><a href="getstarted.html">Getting Started</a></li> | |
| 104 <li><a href="overview.html">Overview</a></li> | |
| 105 <li><a href="whats_new.html">What's New?</a></li> | |
| 106 <li><h2><a href="devguide.html">Developer's Guide</a></h2> | |
| 107 <ul> | |
| 108 <li>Browser UI | |
| 109 <ul> | |
| 110 <li><a href="browserAction.html">Browser Actions</a></li> | |
| 111 <li><a href="contextMenus.html">Context Menus</a></li> | |
| 112 <li><a href="notifications.html">Desktop Notifications</a></li
> | |
| 113 <li><a href="omnibox.html">Omnibox</a></li> | |
| 114 <li><a href="options.html">Options Pages</a></li> | |
| 115 <li><a href="override.html">Override Pages</a></li> | |
| 116 <li><a href="pageAction.html">Page Actions</a></li> | |
| 117 </ul> | |
| 118 </li> | |
| 119 <li>Browser Interaction | |
| 120 <ul> | |
| 121 <li><a href="bookmarks.html">Bookmarks</a></li> | |
| 122 <li><a href="cookies.html">Cookies</a></li> | |
| 123 <li><a href="devtools.html">Developer Tools</a></li> | |
| 124 <li><a href="events.html">Events</a></li> | |
| 125 <li><a href="history.html">History</a></li> | |
| 126 <li><a href="management.html">Management</a></li> | |
| 127 <li><a href="tabs.html">Tabs</a></li> | |
| 128 <li><a href="windows.html">Windows</a></li> | |
| 129 </ul> | |
| 130 </li> | |
| 131 <li>Implementation | |
| 132 <ul> | |
| 133 <li><a href="a11y.html">Accessibility</a></li> | |
| 134 <li><a href="background_pages.html">Background Pages</a></li> | |
| 135 <li><a href="content_scripts.html">Content Scripts</a></li> | |
| 136 <li><a href="xhr.html">Cross-Origin XHR</a></li> | |
| 137 <li><a href="i18n.html">Internationalization</a></li> | |
| 138 <li><a href="messaging.html">Message Passing</a></li> | |
| 139 <li><a href="permissions.html">Optional Permissions</a></li> | |
| 140 <li><a href="npapi.html">NPAPI Plugins</a></li> | |
| 141 </ul> | |
| 142 </li> | |
| 143 <li>Finishing | |
| 144 <ul> | |
| 145 <li><a href="hosting.html">Hosting</a></li> | |
| 146 <li><a href="external_extensions.html">Other Deployment Option
s</a></li> | |
| 147 </ul> | |
| 148 </li> | |
| 149 </ul> | |
| 150 </li> | |
| 151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> | |
| 152 <li><h2><a href="tutorials.html">Tutorials</a></h2> | |
| 153 <ul> | |
| 154 <li><a href="tut_debugging.html">Debugging</a></li> | |
| 155 <li><a href="tut_analytics.html">Google Analytics</a></li> | |
| 156 <li><a href="tut_oauth.html">OAuth</a></li> | |
| 157 </ul> | |
| 158 </li> | |
| 159 <li><h2>Reference</h2> | |
| 160 <ul> | |
| 161 <li>Formats | |
| 162 <ul> | |
| 163 <li><a href="manifest.html">Manifest Files</a></li> | |
| 164 <li><a href="match_patterns.html">Match Patterns</a></li> | |
| 165 </ul> | |
| 166 </li> | |
| 167 <li><a href="permission_warnings.html">Permission Warnings</a></li
> | |
| 168 <li><a href="api_index.html">chrome.* APIs</a></li> | |
| 169 <li><a href="api_other.html">Other APIs</a></li> | |
| 170 </ul> | |
| 171 </li> | |
| 172 <li><h2><a href="samples.html">Samples</a></h2></li> | |
| 173 <div class="line"> </div> | |
| 174 <li><h2>More</h2> | |
| 175 <ul> | |
| 176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm
l">Chrome Web Store</a></li> | |
| 177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu
ide.html">Hosted Apps</a></li> | |
| 178 <li><a href="themes.html">Themes</a></li> | |
| 179 </ul> | |
| 180 </li> | |
| 181 </ul> | |
| 182 </div> | |
| 183 <script> | |
| 184 initToggles(); | |
| 185 </script> | |
| 186 <div class="g-unit" id="gc-pagecontent"> | |
| 187 <div id="pageTitle"> | |
| 188 <h1 class="page_title">Speech Input API</h1> | |
| 189 </div> | |
| 190 <!-- TABLE OF CONTENTS --> | |
| 191 <div id="toc"> | |
| 192 <h2>Contents</h2> | |
| 193 <ol> | |
| 194 <li> | |
| 195 <a href="#manifest">Manifest</a> | |
| 196 <ol> | |
| 197 </ol> | |
| 198 </li><li> | |
| 199 <a href="#howToStart">How to start speech recognition</a> | |
| 200 <ol> | |
| 201 </ol> | |
| 202 </li><li> | |
| 203 <a href="#howToGetResults">How to get speech recognition results</
a> | |
| 204 <ol> | |
| 205 </ol> | |
| 206 </li><li> | |
| 207 <a href="#howToStop">How to stop recording</a> | |
| 208 <ol> | |
| 209 </ol> | |
| 210 </li><li> | |
| 211 <a href="#otherFeatures">Other features</a> | |
| 212 <ol> | |
| 213 </ol> | |
| 214 </li><li> | |
| 215 <a href="#examples">Examples</a> | |
| 216 <ol> | |
| 217 </ol> | |
| 218 </li> | |
| 219 <li> | |
| 220 <a href="#apiReference">API reference: chrome.experimental.speec
hInput</a> | |
| 221 <ol> | |
| 222 <li> | |
| 223 <a href="#global-methods">Methods</a> | |
| 224 <ol> | |
| 225 <li> | |
| 226 <a href="#method-isRecording">isRecording</a> | |
| 227 </li><li> | |
| 228 <a href="#method-start">start</a> | |
| 229 </li><li> | |
| 230 <a href="#method-stop">stop</a> | |
| 231 </li> | |
| 232 </ol> | |
| 233 </li> | |
| 234 <li> | |
| 235 <a href="#global-events">Events</a> | |
| 236 <ol> | |
| 237 <li> | |
| 238 <a href="#event-onError">onError</a> | |
| 239 </li><li> | |
| 240 <a href="#event-onResult">onResult</a> | |
| 241 </li><li> | |
| 242 <a href="#event-onSoundEnd">onSoundEnd</a> | |
| 243 </li><li> | |
| 244 <a href="#event-onSoundStart">onSoundStart</a> | |
| 245 </li> | |
| 246 </ol> | |
| 247 </li> | |
| 248 <li> | |
| 249 <a href="#types">Types</a> | |
| 250 <ol> | |
| 251 <li> | |
| 252 <a href="#type-SpeechInputStartOptions">SpeechInputStartOptions<
/a> | |
| 253 <ol> | |
| 254 </ol> | |
| 255 </li><li> | |
| 256 <a href="#type-SpeechInputError">SpeechInputError</a> | |
| 257 <ol> | |
| 258 </ol> | |
| 259 </li><li> | |
| 260 <a href="#type-SpeechInputResultHypothesis">SpeechInputResultHyp
othesis</a> | |
| 261 <ol> | |
| 262 </ol> | |
| 263 </li><li> | |
| 264 <a href="#type-SpeechInputResultEvent">SpeechInputResultEvent</a
> | |
| 265 <ol> | |
| 266 </ol> | |
| 267 </li> | |
| 268 </ol> | |
| 269 </li> | |
| 270 </ol> | |
| 271 </li> | |
| 272 </ol> | |
| 273 </div> | |
| 274 <!-- /TABLE OF CONTENTS --> | |
| 275 <!-- Standard content lead-in for experimental API pages --> | |
| 276 <!-- STATIC CONTENT PLACEHOLDER --> | |
| 277 <div id="static"><div id="pageData-name" class="pageData">Speech Input A
PI</div> | |
| 278 <!-- BEGIN AUTHORED CONTENT --> | |
| 279 <p id="classSummary"> | |
| 280 The <code>chrome.experimental.speechInput</code> module provides | |
| 281 one-shot speech recognition to Chrome extensions. | |
| 282 This module is still experimental. For information on how to use experimental | |
| 283 APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. | |
| 284 </p> | |
| 285 <h2 id="manifest">Manifest</h2> | |
| 286 <p>You must declare the "experimental" permission in the <a href="manifest.html"
>extension manifest</a> to use the speech input | |
| 287 API. | |
| 288 For example:</p> | |
| 289 <pre>{ | |
| 290 "name": "My extension", | |
| 291 ... | |
| 292 <b>"permissions": [ | |
| 293 "experimental" | |
| 294 ]</b>, | |
| 295 ... | |
| 296 }</pre> | |
| 297 <h2 id="howToStart">How to start speech recognition</h2> | |
| 298 <p>To start recognizing speech an extension must call the <code>start()</code> | |
| 299 method. If provided, your callback will be called once recording has | |
| 300 successfully started. In case of error <code>chrome.extension.lastError</code> | |
| 301 will be set.</p> | |
| 302 <p>This API provides exclusive access to the default recording device to the | |
| 303 first extension requesting it. Consequently, any calls to <code>start()</code> | |
| 304 when the device is being used by another extension or web page will fail and set | |
| 305 <code>chrome.extension.lastError</code>. The message <code>requestDenied</code> | |
| 306 will be set if another extension in the same profile is making use of the API. | |
| 307 Otherwise <code>noRecordingDeviceFound</code>, <code>recordingDeviceInUse</code> | |
| 308 or <code>unableToStart</code> will be set depending on the situation.</p> | |
| 309 <p>To check whether recording is currently active, call the | |
| 310 <code>isRecording()</code> method. Please note that it only checks for audio | |
| 311 recording within Chrome.</p> | |
| 312 <h2 id="howToGetResults">How to get speech recognition results</h2> | |
| 313 <p>Listen to the <code>onResult</code> event to receive speech recognition | |
| 314 results.</p> | |
| 315 <pre>var callback = function(result) { ... }; | |
| 316 chrome.experimental.speechInput.onResult.addListener(callback); | |
| 317 </pre> | |
| 318 <p>The <code>result</code> object contains an array of | |
| 319 <a href="#type-SpeechInputResultHypothesis">SpeechInputResultHypothesis</a> | |
| 320 sorted by decreasing likelihood.</p> | |
| 321 <p>Recording automatically stops when results are received. It is safe to call | |
| 322 <code>start()</code> again from the results callback.</p> | |
| 323 <p>To handle errors during speech recognition listen for the | |
| 324 <code>onError</code> event.</p> | |
| 325 <pre>var callback = function(error) { ... }; | |
| 326 chrome.experimental.speechInput.onError.addListener(callback); | |
| 327 </pre> | |
| 328 <p></p>Recording will automatically stop in case of error. | |
| 329 It is safe to call <code>start()</code> again from the error callback.<p></p> | |
| 330 <h2 id="howToStop">How to stop recording</h2> | |
| 331 <p>To stop speech recognition call the <code>stop()</code> method. If provided, | |
| 332 the callback function will be called once recording has successfully stopped. | |
| 333 In case of error <code>chrome.extension.lastError</code> will be set. | |
| 334 </p> | |
| 335 <h2 id="otherFeatures">Other features</h2> | |
| 336 <ul><li> | |
| 337 <code>onSoundStart</code> - Event generated when start of sound is detected | |
| 338 (from previously being silent). | |
| 339 </li><li> | |
| 340 <code>onSoundEnd</code> - Event generated when end of sound is detected (a | |
| 341 continued period of silence). | |
| 342 </li></ul> | |
| 343 <h2 id="examples">Examples</h2> | |
| 344 <p>The following example illustrates how to show a JavaScript alert with the | |
| 345 most likely recognition result.</p> | |
| 346 <pre>function checkStart() { | |
| 347 if (chrome.extension.lastError) { | |
| 348 alert("Couldn't start speech input: " + chrome.extension.lastError.message); | |
| 349 } | |
| 350 } | |
| 351 function recognitionFailed(error) { | |
| 352 alert("Speech input failed: " + error.code); | |
| 353 } | |
| 354 function recognitionSucceeded(result) { | |
| 355 alert("Recognized '" + result.hypotheses[0].utterance + "' with confidence " +
result.hypotheses[0].confidence); | |
| 356 } | |
| 357 chrome.experimental.speechInput.onError.addListener(recognitionFailed); | |
| 358 chrome.experimental.speechInput.onResult.addListener(recognitionSucceeded); | |
| 359 chrome.experimental.speechInput.start({ "language": "en" }, checkStart); | |
| 360 </pre> | |
| 361 </div> | |
| 362 <!-- API PAGE --> | |
| 363 <div class="apiPage"> | |
| 364 <a name="apiReference"></a> | |
| 365 <h2>API reference: chrome.experimental.speechInput</h2> | |
| 366 <!-- PROPERTIES --> | |
| 367 <!-- /apiGroup --> | |
| 368 <!-- METHODS --> | |
| 369 <div id="methodsTemplate" class="apiGroup"> | |
| 370 <a name="global-methods"></a> | |
| 371 <h3>Methods</h3> | |
| 372 <!-- iterates over all functions --> | |
| 373 <div class="apiItem"> | |
| 374 <a name="method-isRecording"></a> <!-- method-anchor --> | |
| 375 <h4>isRecording</h4> | |
| 376 <div class="summary"> | |
| 377 <!-- Note: intentionally longer 80 columns --> | |
| 378 <span>chrome.experimental.speechInput.isRecording</span>(<span
class="optional"><span>function</span> | |
| 379 <var><span>callback</span></var></span>)</div> | |
| 380 <div class="description"> | |
| 381 <p>Determine if audio recording is currently in process in Chrom
e, not limited to this API.</p> | |
| 382 <!-- PARAMETERS --> | |
| 383 <h4>Parameters</h4> | |
| 384 <dl> | |
| 385 <div> | |
| 386 <div> | |
| 387 <dt> | |
| 388 <var>callback</var> | |
| 389 <em> | |
| 390 <!-- TYPE --> | |
| 391 <div style="display:inline"> | |
| 392 ( | |
| 393 <span class="optional">optional</span> | |
| 394 <span id="typeTemplate"> | |
| 395 <span> | |
| 396 <span>function</span> | |
| 397 </span> | |
| 398 </span> | |
| 399 ) | |
| 400 </div> | |
| 401 </em> | |
| 402 </dt> | |
| 403 <dd class="todo"> | |
| 404 Undocumented. | |
| 405 </dd> | |
| 406 <!-- OBJECT PROPERTIES --> | |
| 407 <!-- OBJECT METHODS --> | |
| 408 <!-- OBJECT EVENT FIELDS --> | |
| 409 <!-- FUNCTION PARAMETERS --> | |
| 410 </div> | |
| 411 </div> | |
| 412 </dl> | |
| 413 <!-- RETURNS --> | |
| 414 <dl> | |
| 415 </dl> | |
| 416 <!-- CALLBACK --> | |
| 417 <div> | |
| 418 <div> | |
| 419 <h4>Callback function</h4> | |
| 420 <p> | |
| 421 If you specify the <em>callback</em> parameter, it should | |
| 422 specify a function that looks like this: | |
| 423 </p> | |
| 424 <!-- Note: intentionally longer 80 columns --> | |
| 425 <pre>function(<span>boolean result</span>) <span class="subdue
d">{...}</span>;</pre> | |
| 426 <dl> | |
| 427 <div> | |
| 428 <div> | |
| 429 <dt> | |
| 430 <var>result</var> | |
| 431 <em> | |
| 432 <!-- TYPE --> | |
| 433 <div style="display:inline"> | |
| 434 ( | |
| 435 <span id="typeTemplate"> | |
| 436 <span> | |
| 437 <span>boolean</span> | |
| 438 </span> | |
| 439 </span> | |
| 440 ) | |
| 441 </div> | |
| 442 </em> | |
| 443 </dt> | |
| 444 <dd>Flag set to true if recording is in process in Chrome, false other
wise.</dd> | |
| 445 <!-- OBJECT PROPERTIES --> | |
| 446 <!-- OBJECT METHODS --> | |
| 447 <!-- OBJECT EVENT FIELDS --> | |
| 448 <!-- FUNCTION PARAMETERS --> | |
| 449 </div> | |
| 450 </div> | |
| 451 </dl> | |
| 452 </div> | |
| 453 </div> | |
| 454 <!-- MIN_VERSION --> | |
| 455 </div> <!-- /description --> | |
| 456 </div><div class="apiItem"> | |
| 457 <a name="method-start"></a> <!-- method-anchor --> | |
| 458 <h4>start</h4> | |
| 459 <div class="summary"> | |
| 460 <!-- Note: intentionally longer 80 columns --> | |
| 461 <span>chrome.experimental.speechInput.start</span>(<span class
="optional"><span>SpeechInputStartOptions</span> | |
| 462 <var><span>options</span></var></span><span class="optiona
l"><span>, </span><span>function</span> | |
| 463 <var><span>callback</span></var></span>)</div> | |
| 464 <div class="description"> | |
| 465 <p>Request to start recording as a new speech recognition sessio
n.</p> | |
| 466 <!-- PARAMETERS --> | |
| 467 <h4>Parameters</h4> | |
| 468 <dl> | |
| 469 <div> | |
| 470 <div> | |
| 471 <dt> | |
| 472 <var>options</var> | |
| 473 <em> | |
| 474 <!-- TYPE --> | |
| 475 <div style="display:inline"> | |
| 476 ( | |
| 477 <span class="optional">optional</span> | |
| 478 <span id="typeTemplate"> | |
| 479 <span> | |
| 480 <a href="experimental.speechInput.html#type-SpeechInputS
tartOptions">SpeechInputStartOptions</a> | |
| 481 </span> | |
| 482 </span> | |
| 483 ) | |
| 484 </div> | |
| 485 </em> | |
| 486 </dt> | |
| 487 <dd>Options used for this speech recognition session.</dd> | |
| 488 <!-- OBJECT PROPERTIES --> | |
| 489 <!-- OBJECT METHODS --> | |
| 490 <!-- OBJECT EVENT FIELDS --> | |
| 491 <!-- FUNCTION PARAMETERS --> | |
| 492 </div> | |
| 493 </div><div> | |
| 494 <div> | |
| 495 <dt> | |
| 496 <var>callback</var> | |
| 497 <em> | |
| 498 <!-- TYPE --> | |
| 499 <div style="display:inline"> | |
| 500 ( | |
| 501 <span class="optional">optional</span> | |
| 502 <span id="typeTemplate"> | |
| 503 <span> | |
| 504 <span>function</span> | |
| 505 </span> | |
| 506 </span> | |
| 507 ) | |
| 508 </div> | |
| 509 </em> | |
| 510 </dt> | |
| 511 <dd>Called when the speech recognition session has successfully starte
d recording.</dd> | |
| 512 <!-- OBJECT PROPERTIES --> | |
| 513 <!-- OBJECT METHODS --> | |
| 514 <!-- OBJECT EVENT FIELDS --> | |
| 515 <!-- FUNCTION PARAMETERS --> | |
| 516 </div> | |
| 517 </div> | |
| 518 </dl> | |
| 519 <!-- RETURNS --> | |
| 520 <dl> | |
| 521 </dl> | |
| 522 <!-- CALLBACK --> | |
| 523 <div> | |
| 524 <div> | |
| 525 <h4>Callback function</h4> | |
| 526 <p> | |
| 527 If you specify the <em>callback</em> parameter, it should | |
| 528 specify a function that looks like this: | |
| 529 </p> | |
| 530 <!-- Note: intentionally longer 80 columns --> | |
| 531 <pre>function(<span></span>) <span class="subdued">{...}</span
>;</pre> | |
| 532 <dl> | |
| 533 </dl> | |
| 534 </div> | |
| 535 </div> | |
| 536 <!-- MIN_VERSION --> | |
| 537 </div> <!-- /description --> | |
| 538 </div><div class="apiItem"> | |
| 539 <a name="method-stop"></a> <!-- method-anchor --> | |
| 540 <h4>stop</h4> | |
| 541 <div class="summary"> | |
| 542 <!-- Note: intentionally longer 80 columns --> | |
| 543 <span>chrome.experimental.speechInput.stop</span>(<span class=
"optional"><span>function</span> | |
| 544 <var><span>callback</span></var></span>)</div> | |
| 545 <div class="description"> | |
| 546 <p>Request to stop an ongoing speech recognition session.</p> | |
| 547 <!-- PARAMETERS --> | |
| 548 <h4>Parameters</h4> | |
| 549 <dl> | |
| 550 <div> | |
| 551 <div> | |
| 552 <dt> | |
| 553 <var>callback</var> | |
| 554 <em> | |
| 555 <!-- TYPE --> | |
| 556 <div style="display:inline"> | |
| 557 ( | |
| 558 <span class="optional">optional</span> | |
| 559 <span id="typeTemplate"> | |
| 560 <span> | |
| 561 <span>function</span> | |
| 562 </span> | |
| 563 </span> | |
| 564 ) | |
| 565 </div> | |
| 566 </em> | |
| 567 </dt> | |
| 568 <dd>Called when the audio recording has stopped and any pending recogn
ition results have been completed.</dd> | |
| 569 <!-- OBJECT PROPERTIES --> | |
| 570 <!-- OBJECT METHODS --> | |
| 571 <!-- OBJECT EVENT FIELDS --> | |
| 572 <!-- FUNCTION PARAMETERS --> | |
| 573 </div> | |
| 574 </div> | |
| 575 </dl> | |
| 576 <!-- RETURNS --> | |
| 577 <dl> | |
| 578 </dl> | |
| 579 <!-- CALLBACK --> | |
| 580 <div> | |
| 581 <div> | |
| 582 <h4>Callback function</h4> | |
| 583 <p> | |
| 584 If you specify the <em>callback</em> parameter, it should | |
| 585 specify a function that looks like this: | |
| 586 </p> | |
| 587 <!-- Note: intentionally longer 80 columns --> | |
| 588 <pre>function(<span></span>) <span class="subdued">{...}</span
>;</pre> | |
| 589 <dl> | |
| 590 </dl> | |
| 591 </div> | |
| 592 </div> | |
| 593 <!-- MIN_VERSION --> | |
| 594 </div> <!-- /description --> | |
| 595 </div> <!-- /apiItem --> | |
| 596 </div> <!-- /apiGroup --> | |
| 597 <!-- EVENTS --> | |
| 598 <div id="eventsTemplate" class="apiGroup"> | |
| 599 <a name="global-events"></a> | |
| 600 <h3>Events</h3> | |
| 601 <!-- iterates over all events --> | |
| 602 <div class="apiItem"> | |
| 603 <a name="event-onError"></a> | |
| 604 <h4>onError</h4> | |
| 605 <div class="summary"> | |
| 606 <!-- Note: intentionally longer 80 columns --> | |
| 607 <span class="subdued">chrome.experimental.speechInput.</span><sp
an>onError</span><span class="subdued">.addListener</span>(function(<span>Speech
InputError error</span>) <span class="subdued">{...}</span><span></span>); | |
| 608 </div> | |
| 609 <div class="description"> | |
| 610 <p>Called in case of an error in speech recognition.</p> | |
| 611 <!-- LISTENER PARAMETERS --> | |
| 612 <div> | |
| 613 <h4>Listener parameters</h4> | |
| 614 <dl> | |
| 615 <div> | |
| 616 <div> | |
| 617 <dt> | |
| 618 <var>error</var> | |
| 619 <em> | |
| 620 <!-- TYPE --> | |
| 621 <div style="display:inline"> | |
| 622 ( | |
| 623 <span id="typeTemplate"> | |
| 624 <span> | |
| 625 <a href="experimental.speechInput.html#type-SpeechInputE
rror">SpeechInputError</a> | |
| 626 </span> | |
| 627 </span> | |
| 628 ) | |
| 629 </div> | |
| 630 </em> | |
| 631 </dt> | |
| 632 <dd>Error being reported.</dd> | |
| 633 <!-- OBJECT PROPERTIES --> | |
| 634 <!-- OBJECT METHODS --> | |
| 635 <!-- OBJECT EVENT FIELDS --> | |
| 636 <!-- FUNCTION PARAMETERS --> | |
| 637 </div> | |
| 638 </div> | |
| 639 </dl> | |
| 640 </div> | |
| 641 <!-- EXTRA PARAMETERS --> | |
| 642 <!-- LISTENER RETURN VALUE --> | |
| 643 <dl> | |
| 644 </dl> | |
| 645 </div> <!-- /description --> | |
| 646 <!-- /description --> | |
| 647 </div><div class="apiItem"> | |
| 648 <a name="event-onResult"></a> | |
| 649 <h4>onResult</h4> | |
| 650 <div class="summary"> | |
| 651 <!-- Note: intentionally longer 80 columns --> | |
| 652 <span class="subdued">chrome.experimental.speechInput.</span><sp
an>onResult</span><span class="subdued">.addListener</span>(function(<span>Speec
hInputResultEvent event</span>) <span class="subdued">{...}</span><span></span>)
; | |
| 653 </div> | |
| 654 <div class="description"> | |
| 655 <p>Called when speech recognition results are available.</p> | |
| 656 <!-- LISTENER PARAMETERS --> | |
| 657 <div> | |
| 658 <h4>Listener parameters</h4> | |
| 659 <dl> | |
| 660 <div> | |
| 661 <div> | |
| 662 <dt> | |
| 663 <var>event</var> | |
| 664 <em> | |
| 665 <!-- TYPE --> | |
| 666 <div style="display:inline"> | |
| 667 ( | |
| 668 <span id="typeTemplate"> | |
| 669 <span> | |
| 670 <a href="experimental.speechInput.html#type-SpeechInputR
esultEvent">SpeechInputResultEvent</a> | |
| 671 </span> | |
| 672 </span> | |
| 673 ) | |
| 674 </div> | |
| 675 </em> | |
| 676 </dt> | |
| 677 <dd>Object containing the speech recognition results.</dd> | |
| 678 <!-- OBJECT PROPERTIES --> | |
| 679 <!-- OBJECT METHODS --> | |
| 680 <!-- OBJECT EVENT FIELDS --> | |
| 681 <!-- FUNCTION PARAMETERS --> | |
| 682 </div> | |
| 683 </div> | |
| 684 </dl> | |
| 685 </div> | |
| 686 <!-- EXTRA PARAMETERS --> | |
| 687 <!-- LISTENER RETURN VALUE --> | |
| 688 <dl> | |
| 689 </dl> | |
| 690 </div> <!-- /description --> | |
| 691 <!-- /description --> | |
| 692 </div><div class="apiItem"> | |
| 693 <a name="event-onSoundEnd"></a> | |
| 694 <h4>onSoundEnd</h4> | |
| 695 <div class="summary"> | |
| 696 <!-- Note: intentionally longer 80 columns --> | |
| 697 <span class="subdued">chrome.experimental.speechInput.</span><sp
an>onSoundEnd</span><span class="subdued">.addListener</span>(function(<span></s
pan>) <span class="subdued">{...}</span><span></span>); | |
| 698 </div> | |
| 699 <div class="description"> | |
| 700 <p>Called when the system detects enough silence to consider the
ongoing speech has ended.</p> | |
| 701 <!-- LISTENER PARAMETERS --> | |
| 702 <!-- EXTRA PARAMETERS --> | |
| 703 <!-- LISTENER RETURN VALUE --> | |
| 704 <dl> | |
| 705 </dl> | |
| 706 </div> <!-- /description --> | |
| 707 <!-- /description --> | |
| 708 </div><div class="apiItem"> | |
| 709 <a name="event-onSoundStart"></a> | |
| 710 <h4>onSoundStart</h4> | |
| 711 <div class="summary"> | |
| 712 <!-- Note: intentionally longer 80 columns --> | |
| 713 <span class="subdued">chrome.experimental.speechInput.</span><sp
an>onSoundStart</span><span class="subdued">.addListener</span>(function(<span><
/span>) <span class="subdued">{...}</span><span></span>); | |
| 714 </div> | |
| 715 <div class="description"> | |
| 716 <p>Called when the system starts detecting sound in the input da
ta.</p> | |
| 717 <!-- LISTENER PARAMETERS --> | |
| 718 <!-- EXTRA PARAMETERS --> | |
| 719 <!-- LISTENER RETURN VALUE --> | |
| 720 <dl> | |
| 721 </dl> | |
| 722 </div> <!-- /description --> | |
| 723 <!-- /description --> | |
| 724 </div> <!-- /apiItem --> | |
| 725 </div> <!-- /apiGroup --> | |
| 726 <!-- TYPES --> | |
| 727 <div class="apiGroup"> | |
| 728 <a name="types"></a> | |
| 729 <h3 id="types">Types</h3> | |
| 730 <!-- iterates over all types --> | |
| 731 <div class="apiItem"> | |
| 732 <a name="type-SpeechInputStartOptions"></a> | |
| 733 <h4>SpeechInputStartOptions</h4> | |
| 734 <div> | |
| 735 <dt> | |
| 736 <em> | |
| 737 <!-- TYPE --> | |
| 738 <div style="display:inline"> | |
| 739 ( | |
| 740 <span id="typeTemplate"> | |
| 741 <span> | |
| 742 <span>object</span> | |
| 743 </span> | |
| 744 </span> | |
| 745 ) | |
| 746 </div> | |
| 747 </em> | |
| 748 </dt> | |
| 749 <dd>Object describing the options used for speech recognition.</dd> | |
| 750 <!-- OBJECT PROPERTIES --> | |
| 751 <dd> | |
| 752 <dl> | |
| 753 <div> | |
| 754 <div> | |
| 755 <dt> | |
| 756 <var>language</var> | |
| 757 <em> | |
| 758 <!-- TYPE --> | |
| 759 <div style="display:inline"> | |
| 760 ( | |
| 761 <span class="optional">optional</span> | |
| 762 <span id="typeTemplate"> | |
| 763 <span> | |
| 764 <span>string</span> | |
| 765 </span> | |
| 766 </span> | |
| 767 ) | |
| 768 </div> | |
| 769 </em> | |
| 770 </dt> | |
| 771 <dd>BCP-47 language code of the language to recognize. When set to 'au
to' or not defined defaults to user's most preferred content language. Will use
'en-US' if not supported or invalid.</dd> | |
| 772 <!-- OBJECT PROPERTIES --> | |
| 773 <!-- OBJECT METHODS --> | |
| 774 <!-- OBJECT EVENT FIELDS --> | |
| 775 <!-- FUNCTION PARAMETERS --> | |
| 776 </div> | |
| 777 </div><div> | |
| 778 <div> | |
| 779 <dt> | |
| 780 <var>grammar</var> | |
| 781 <em> | |
| 782 <!-- TYPE --> | |
| 783 <div style="display:inline"> | |
| 784 ( | |
| 785 <span class="optional">optional</span> | |
| 786 <span id="typeTemplate"> | |
| 787 <span> | |
| 788 <span>string</span> | |
| 789 </span> | |
| 790 </span> | |
| 791 ) | |
| 792 </div> | |
| 793 </em> | |
| 794 </dt> | |
| 795 <dd>Name of the grammar to use. Defaults to 'builtin:dictation'.</dd> | |
| 796 <!-- OBJECT PROPERTIES --> | |
| 797 <!-- OBJECT METHODS --> | |
| 798 <!-- OBJECT EVENT FIELDS --> | |
| 799 <!-- FUNCTION PARAMETERS --> | |
| 800 </div> | |
| 801 </div><div> | |
| 802 <div> | |
| 803 <dt> | |
| 804 <var>filterProfanities</var> | |
| 805 <em> | |
| 806 <!-- TYPE --> | |
| 807 <div style="display:inline"> | |
| 808 ( | |
| 809 <span class="optional">optional</span> | |
| 810 <span id="typeTemplate"> | |
| 811 <span> | |
| 812 <span>boolean</span> | |
| 813 </span> | |
| 814 </span> | |
| 815 ) | |
| 816 </div> | |
| 817 </em> | |
| 818 </dt> | |
| 819 <dd>Enable or disable profanity filtering. Will use the default Chrome
filtering settings if not set.</dd> | |
| 820 <!-- OBJECT PROPERTIES --> | |
| 821 <!-- OBJECT METHODS --> | |
| 822 <!-- OBJECT EVENT FIELDS --> | |
| 823 <!-- FUNCTION PARAMETERS --> | |
| 824 </div> | |
| 825 </div> | |
| 826 </dl> | |
| 827 </dd> | |
| 828 <!-- OBJECT METHODS --> | |
| 829 <!-- OBJECT EVENT FIELDS --> | |
| 830 <!-- FUNCTION PARAMETERS --> | |
| 831 </div> | |
| 832 </div><div class="apiItem"> | |
| 833 <a name="type-SpeechInputError"></a> | |
| 834 <h4>SpeechInputError</h4> | |
| 835 <div> | |
| 836 <dt> | |
| 837 <em> | |
| 838 <!-- TYPE --> | |
| 839 <div style="display:inline"> | |
| 840 ( | |
| 841 <span id="typeTemplate"> | |
| 842 <span> | |
| 843 <span>object</span> | |
| 844 </span> | |
| 845 </span> | |
| 846 ) | |
| 847 </div> | |
| 848 </em> | |
| 849 </dt> | |
| 850 <dd>Object describing a speech input error.</dd> | |
| 851 <!-- OBJECT PROPERTIES --> | |
| 852 <dd> | |
| 853 <dl> | |
| 854 <div> | |
| 855 <div> | |
| 856 <dt> | |
| 857 <var>code</var> | |
| 858 <em> | |
| 859 <!-- TYPE --> | |
| 860 <div style="display:inline"> | |
| 861 ( | |
| 862 <span class="enum">enumerated</span> | |
| 863 <span id="typeTemplate"> | |
| 864 <span> | |
| 865 <span>string</span> | |
| 866 <span>["noSpeechHeard", "noResults", "captureError", "ne
tworkError"]</span> | |
| 867 </span> | |
| 868 </span> | |
| 869 ) | |
| 870 </div> | |
| 871 </em> | |
| 872 </dt> | |
| 873 <dd>Code identifying the error case.</dd> | |
| 874 <!-- OBJECT PROPERTIES --> | |
| 875 <!-- OBJECT METHODS --> | |
| 876 <!-- OBJECT EVENT FIELDS --> | |
| 877 <!-- FUNCTION PARAMETERS --> | |
| 878 </div> | |
| 879 </div> | |
| 880 </dl> | |
| 881 </dd> | |
| 882 <!-- OBJECT METHODS --> | |
| 883 <!-- OBJECT EVENT FIELDS --> | |
| 884 <!-- FUNCTION PARAMETERS --> | |
| 885 </div> | |
| 886 </div><div class="apiItem"> | |
| 887 <a name="type-SpeechInputResultHypothesis"></a> | |
| 888 <h4>SpeechInputResultHypothesis</h4> | |
| 889 <div> | |
| 890 <dt> | |
| 891 <em> | |
| 892 <!-- TYPE --> | |
| 893 <div style="display:inline"> | |
| 894 ( | |
| 895 <span id="typeTemplate"> | |
| 896 <span> | |
| 897 <span>object</span> | |
| 898 </span> | |
| 899 </span> | |
| 900 ) | |
| 901 </div> | |
| 902 </em> | |
| 903 </dt> | |
| 904 <dd>Object describing a speech recognition hypothesis.</dd> | |
| 905 <!-- OBJECT PROPERTIES --> | |
| 906 <dd> | |
| 907 <dl> | |
| 908 <div> | |
| 909 <div> | |
| 910 <dt> | |
| 911 <var>utterance</var> | |
| 912 <em> | |
| 913 <!-- TYPE --> | |
| 914 <div style="display:inline"> | |
| 915 ( | |
| 916 <span id="typeTemplate"> | |
| 917 <span> | |
| 918 <span>string</span> | |
| 919 </span> | |
| 920 </span> | |
| 921 ) | |
| 922 </div> | |
| 923 </em> | |
| 924 </dt> | |
| 925 <dd>Text of this hypothesis.</dd> | |
| 926 <!-- OBJECT PROPERTIES --> | |
| 927 <!-- OBJECT METHODS --> | |
| 928 <!-- OBJECT EVENT FIELDS --> | |
| 929 <!-- FUNCTION PARAMETERS --> | |
| 930 </div> | |
| 931 </div><div> | |
| 932 <div> | |
| 933 <dt> | |
| 934 <var>confidence</var> | |
| 935 <em> | |
| 936 <!-- TYPE --> | |
| 937 <div style="display:inline"> | |
| 938 ( | |
| 939 <span id="typeTemplate"> | |
| 940 <span> | |
| 941 <span>number</span> | |
| 942 </span> | |
| 943 </span> | |
| 944 ) | |
| 945 </div> | |
| 946 </em> | |
| 947 </dt> | |
| 948 <dd>Confidence of the hypothesis. Rated from 0 (lowest) to 1 (highest)
.</dd> | |
| 949 <!-- OBJECT PROPERTIES --> | |
| 950 <!-- OBJECT METHODS --> | |
| 951 <!-- OBJECT EVENT FIELDS --> | |
| 952 <!-- FUNCTION PARAMETERS --> | |
| 953 </div> | |
| 954 </div> | |
| 955 </dl> | |
| 956 </dd> | |
| 957 <!-- OBJECT METHODS --> | |
| 958 <!-- OBJECT EVENT FIELDS --> | |
| 959 <!-- FUNCTION PARAMETERS --> | |
| 960 </div> | |
| 961 </div><div class="apiItem"> | |
| 962 <a name="type-SpeechInputResultEvent"></a> | |
| 963 <h4>SpeechInputResultEvent</h4> | |
| 964 <div> | |
| 965 <dt> | |
| 966 <em> | |
| 967 <!-- TYPE --> | |
| 968 <div style="display:inline"> | |
| 969 ( | |
| 970 <span id="typeTemplate"> | |
| 971 <span> | |
| 972 <span>object</span> | |
| 973 </span> | |
| 974 </span> | |
| 975 ) | |
| 976 </div> | |
| 977 </em> | |
| 978 </dt> | |
| 979 <dd>Object containing the recognition results.</dd> | |
| 980 <!-- OBJECT PROPERTIES --> | |
| 981 <dd> | |
| 982 <dl> | |
| 983 <div> | |
| 984 <div> | |
| 985 <dt> | |
| 986 <var>hypotheses</var> | |
| 987 <em> | |
| 988 <!-- TYPE --> | |
| 989 <div style="display:inline"> | |
| 990 ( | |
| 991 <span class="optional">optional</span> | |
| 992 <span id="typeTemplate"> | |
| 993 <span> | |
| 994 <span> | |
| 995 array of <span><span> | |
| 996 <span> | |
| 997 <a href="experimental.speechInput.html#type-SpeechInputR
esultHypothesis">SpeechInputResultHypothesis</a> | |
| 998 </span> | |
| 999 </span></span> | |
| 1000 </span> | |
| 1001 </span> | |
| 1002 </span> | |
| 1003 ) | |
| 1004 </div> | |
| 1005 </em> | |
| 1006 </dt> | |
| 1007 <dd>Array of zero or more objects describing the stable candidate hypo
theses sorted by decreasing likelihood.</dd> | |
| 1008 <!-- OBJECT PROPERTIES --> | |
| 1009 <!-- OBJECT METHODS --> | |
| 1010 <!-- OBJECT EVENT FIELDS --> | |
| 1011 <!-- FUNCTION PARAMETERS --> | |
| 1012 </div> | |
| 1013 </div> | |
| 1014 </dl> | |
| 1015 </dd> | |
| 1016 <!-- OBJECT METHODS --> | |
| 1017 <!-- OBJECT EVENT FIELDS --> | |
| 1018 <!-- FUNCTION PARAMETERS --> | |
| 1019 </div> | |
| 1020 </div> <!-- /apiItem --> | |
| 1021 </div> <!-- /apiGroup --> | |
| 1022 </div> <!-- /apiPage --> | |
| 1023 </div> <!-- /gc-pagecontent --> | |
| 1024 </div> <!-- /g-section --> | |
| 1025 </div> <!-- /codesiteContent --> | |
| 1026 <div id="gc-footer" --=""> | |
| 1027 <div class="text"> | |
| 1028 <p> | |
| 1029 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, | |
| 1030 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons | |
| 1031 Attribution 3.0 License</a>, and code samples are licensed under the | |
| 1032 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. | |
| 1033 </p> | |
| 1034 <p> | |
| 1035 ©2011 Google | |
| 1036 </p> | |
| 1037 <!-- begin analytics --> | |
| 1038 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script> | |
| 1039 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
ript> | |
| 1040 <script type="text/javascript"> | |
| 1041 // chrome doc tracking | |
| 1042 try { | |
| 1043 var engdocs = _gat._getTracker("YT-10763712-2"); | |
| 1044 engdocs._trackPageview(); | |
| 1045 } catch(err) {} | |
| 1046 // code.google.com site-wide tracking | |
| 1047 try { | |
| 1048 _uacct="UA-18071-1"; | |
| 1049 _uanchor=1; | |
| 1050 _uff=0; | |
| 1051 urchinTracker(); | |
| 1052 } | |
| 1053 catch(e) {/* urchinTracker not available. */} | |
| 1054 </script> | |
| 1055 <!-- end analytics --> | |
| 1056 </div> | |
| 1057 </div> <!-- /gc-footer --> | |
| 1058 </div> <!-- /gc-container --> | |
| 1059 </body></html> | |
| OLD | NEW |