| Index: chrome/common/extensions/docs/experimental.speechInput.html
|
| diff --git a/chrome/common/extensions/docs/experimental.speechInput.html b/chrome/common/extensions/docs/experimental.speechInput.html
|
| index 5638b28d99abde2b13052732c2fe919588ccbf20..13c327e2544e578b7a14c009a15fc9f900737d2c 100644
|
| --- a/chrome/common/extensions/docs/experimental.speechInput.html
|
| +++ b/chrome/common/extensions/docs/experimental.speechInput.html
|
| @@ -16,7 +16,7 @@
|
| <script type="text/javascript" src="js/api_page_generator.js"></script>
|
| <script type="text/javascript" src="js/bootstrap.js"></script>
|
| <script type="text/javascript" src="js/sidebar.js"></script>
|
| - <title>chrome.experimental.speechInput - Google Chrome Extensions - Google Code</title></head>
|
| + <title>Speech Input API - Google Chrome Extensions - Google Code</title></head>
|
| <body> <div id="gc-container" class="labs">
|
| <div id="devModeWarning">
|
| You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
|
| @@ -291,16 +291,51 @@
|
|
|
| <div class="g-unit" id="gc-pagecontent">
|
| <div id="pageTitle">
|
| - <h1 class="page_title">chrome.experimental.speechInput</h1>
|
| + <h1 class="page_title">Speech Input API</h1>
|
| </div>
|
| <!-- TABLE OF CONTENTS -->
|
| <div id="toc">
|
| <h2>Contents</h2>
|
| <ol>
|
| - <li style="display: none; ">
|
| - <a>h2Name</a>
|
| + <li>
|
| + <a href="#manifest">Manifest</a>
|
| <ol>
|
| - <li>
|
| + <li style="display: none; ">
|
| + <a>h3Name</a>
|
| + </li>
|
| + </ol>
|
| + </li><li>
|
| + <a href="#howToStart">How to start speech recognition</a>
|
| + <ol>
|
| + <li style="display: none; ">
|
| + <a>h3Name</a>
|
| + </li>
|
| + </ol>
|
| + </li><li>
|
| + <a href="#howToGetResults">How to get speech recognition results</a>
|
| + <ol>
|
| + <li style="display: none; ">
|
| + <a>h3Name</a>
|
| + </li>
|
| + </ol>
|
| + </li><li>
|
| + <a href="#howToStop">How to stop recording</a>
|
| + <ol>
|
| + <li style="display: none; ">
|
| + <a>h3Name</a>
|
| + </li>
|
| + </ol>
|
| + </li><li>
|
| + <a href="#otherFeatures">Other features</a>
|
| + <ol>
|
| + <li style="display: none; ">
|
| + <a>h3Name</a>
|
| + </li>
|
| + </ol>
|
| + </li><li>
|
| + <a href="#examples">Examples</a>
|
| + <ol>
|
| + <li style="display: none; ">
|
| <a>h3Name</a>
|
| </li>
|
| </ol>
|
| @@ -435,12 +470,118 @@
|
| <!-- /TABLE OF CONTENTS -->
|
|
|
| <!-- Standard content lead-in for experimental API pages -->
|
| - <p id="classSummary">
|
| + <p id="classSummary" style="display: none; ">
|
| For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
|
| </p>
|
|
|
| <!-- STATIC CONTENT PLACEHOLDER -->
|
| - <div id="static"></div>
|
| + <div id="static"><div id="pageData-name" class="pageData">Speech Input API</div>
|
| +
|
| +<!-- BEGIN AUTHORED CONTENT -->
|
| +<p id="classSummary">
|
| +The <code>chrome.experimental.speechInput</code> module provides
|
| +one-shot speech recognition to Chrome extensions.
|
| +This module is still experimental. For information on how to use experimental
|
| +APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
|
| +</p>
|
| +
|
| +<h2 id="manifest">Manifest</h2>
|
| +<p>You must declare the "experimental" permission in the <a href="manifest.html">extension manifest</a> to use the speechInput
|
| +API.
|
| +For example:</p>
|
| +<pre>{
|
| + "name": "My extension",
|
| + ...
|
| + <b>"permissions": [
|
| + "experimental"
|
| + ]</b>,
|
| + ...
|
| +}</pre>
|
| +
|
| +<h2 id="howToStart">How to start speech recognition</h2>
|
| +<p>To start recognizing speech an extension must call the <code>start</code>
|
| +method. If provided, <code>callback</code> will be called once recording has
|
| +successfully started. In case of error <code>chrome.extension.lastError</code>
|
| +will be set.</p>
|
| +
|
| +<p>This API provides exclusive access to the default recording device to the
|
| +first extension requesting it. Consequently, any calls to <code>start</code>
|
| +when the device is being used by other extension or web page will fail and set
|
| +<code>chrome.extension.lastError</code>. The message <code>requestDenied</code>
|
| +will be set if another extension in the same profile is making use of the API,
|
| +otherwise <code>noRecordingDeviceFound</code>, <code>recordingDeviceInUse</code>
|
| +or <code>unableToStart</code> will be set depending on the situation.</p>
|
| +
|
| +<p>To check if recording is currently active use call the <code>isRecording</code>
|
| +method. Please note that it only checks for audio recording within Chrome.</p>
|
| +
|
| +
|
| +<h2 id="howToGetResults">How to get speech recognition results</h2>
|
| +<p>Listen to the <code>onResult</code> event to receive speech recognition
|
| +results.</p>
|
| +
|
| +<pre>var callback = function(result) { ... };
|
| +
|
| +chrome.experimental.speechInput.onResult.addListener(callback);
|
| +</pre>
|
| +
|
| +<p>The <code>result</code> object contains an array of recognition hypotheses
|
| +sorted by decreasing likelihood.</p>
|
| +
|
| +<p>Recording automatically stops when results are received. It is safe to call
|
| +<code>start</code> again from the results callback.</p>
|
| +
|
| +<p>To handle errors during speech recognition listen for the
|
| +<code>onError</code> event.</p>
|
| +
|
| +<pre>var callback = function(error) { ... };
|
| +
|
| +chrome.experimental.speechInput.onError.addListener(callback);
|
| +</pre>
|
| +
|
| +<p></p>Recording will automatically stop in case on error.
|
| +It is safe to call <code>start</code> again from the error callback.<p></p>
|
| +
|
| +
|
| +<h2 id="howToStop">How to stop recording</h2>
|
| +<p>To stop speech recognition call the <code>stop</code> method. If provided,
|
| +<code>callback</code> will be called once recording has successfully
|
| +stopped. In case of error <code>chrome.extension.lastError</code> will be set.
|
| +</p>
|
| +
|
| +
|
| +<h2 id="otherFeatures">Other features</h2>
|
| +<ul><li>
|
| +<code>onSoundStart</code> - Event generated when start of sound is detected
|
| +(from previously being silent).
|
| +</li><li>
|
| +<code>onSoundEnd</code> - Event generated when end of sound is detected (a
|
| +continued period of silence).
|
| +</li></ul>
|
| +
|
| +
|
| +<h2 id="examples">Examples</h2>
|
| +<p>The following example illustrates how to show a javascript alert with the
|
| +most likely recognition result.</p>
|
| +<pre>function checkStart() {
|
| + if (chrome.extension.lastError) {
|
| + alert("Couldn't start speech input: " + chrome.extension.lastError.message);
|
| + }
|
| +}
|
| +
|
| +function recognitionFailed(error) {
|
| + alert("Speech input failed: " + error.code);
|
| +}
|
| +
|
| +function recognitionSucceeded(result) {
|
| + alert(result.hypotheses[0].utterance);
|
| +}
|
| +
|
| +chrome.experimental.speechInput.onError.addListener(recognitionFailed);
|
| +chrome.experimental.speechInput.onResult.addListener(recognitionSucceded);
|
| +chrome.experimental.speechInput.start({ "language": "en" }, checkStart);
|
| +</pre>
|
| +</div>
|
|
|
| <!-- API PAGE -->
|
| <div class="apiPage">
|
|
|