- From: Ilkka Oksanen via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 12 Nov 2010 11:27:57 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/camera In directory hutz:/tmp/cvs-serv15328 Modified Files: Overview-API.html Log Message: added format attribute to image, audio, and video capture options. Index: Overview-API.html =================================================================== RCS file: /sources/public/2009/dap/camera/Overview-API.html,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Overview-API.html 5 Nov 2010 13:39:28 -0000 1.34 +++ Overview-API.html 12 Nov 2010 11:27:55 -0000 1.35 @@ -45,7 +45,7 @@ microphone and camera of a hosting device. It completes the HTML Form Based Media Capturing specification [[!HTMLMEDIACAPTURE]] with a programmatic access to start a parametrized capture process.</p> <section id="examples"> - <h2>Usage Examples</h2> + <h2>Usage Example</h2> <p>The following code extracts illustrate how to work with a camera service in the hosting device:</p> @@ -56,6 +56,19 @@ <pre class="example sh_javascript_dom"> +allformats = navigator.device.capture.supportedImageFormats; + +var width = 0; +var selectedformat; + +// Select the format with the highest width +for each (var format in allformats) { + if (allformats.width > width) { + width = format.width; + selectedformat = format; + } +} + function success(data) { var container = document.createElement("div"); @@ -77,28 +90,10 @@ } } -navigator.device.capture.captureImage(success, error, { limit: 1 }); - - </pre> - </div> - <div> - - <p>Example of retrieving image sizes and formats supported by hosting - device camera.</p> - - <pre class="example sh_javascript_dom">var summary; - -formats = navigator.device.capture.supportedImageFormats; - -for (var key in formats) { - summary += key + ": " + formats[key] + "\n"; -} - -alert(summary); +navigator.device.capture.captureImage(success, error, { limit: 1, format: selectedformat }); </pre> </div> - </section> <section> @@ -420,40 +415,37 @@ <p>The <a>CaptureImageOptions</a> interface encapsulates all image capture operation configuration options.</p> - <p class="note">Additional attributes proposed: <code>width</code> - and <code>height</code>.</p> - <p class="note">We might want to add <code>format</code> to give author control - over the capture format.</p> - <dl title="[NoInterfaceObject] interface CaptureImageOptions" class="idl"> <dt>attribute unsigned long limit</dt> <dd>Upper limit of images user can take. Value MUST be equal or greater than one.</dd> + <dt>attribute MediaFileData format</dt> + <dd>The selected image format. Must match to one of the elements in <a href="#widl-Capture-supportedImageFormats"><code>supportedImageFormats</code></a> array.</dd> + </dl> </section> <section id="capturevideooptions"><h3><a>CaptureVideoOptions</a> interface</h3> - <p class="note">We might want to add <code>format</code> to give author control - over the capture format.</p> - <dl title="[NoInterfaceObject] interface CaptureVideoOptions" class="idl"> <dt>attribute unsigned long limit</dt> <dd>Upper limit of videos user can record. Value MUST be equal or greater than one</dd> <dt>attribute float duration</dt> <dd>Maximum duration of a single video clip in seconds.</dd> + <dt>attribute MediaFileData format</dt> + <dd>The selected video format. Must match with one of the elements in <a href="#widl-Capture-supportedVideoFormats"><code>supportedVideoFormats</code></a> array.</dd> </dl> </section> <section id="captureaudiooptions"><h3><a>CaptureAudioOptions</a> interface</h3> - <p class="note">Additional attributes proposed: <code>duration</code>.</p> - <p class="note">We might want to add <code>format</code> to give author control - over the capture format.</p> - <dl title="[NoInterfaceObject] interface CaptureAudioOptions" class="idl"> <dt>attribute unsigned long limit</dt> <dd>Upper limit of sound clips user can record. Value MUST be equal or greater than one</dd> + <dt>attribute float duration</dt> + <dd>Maximum duration of a single sound clip in seconds.</dd> + <dt>attribute MediaFileData format</dt> + <dd>The selected audio format. Must match with one of the elements in <a href="#widl-Capture-supportedAudioFormats"><code>supportedAudioFormats</code></a> array.</dd> </dl> </section>
Received on Friday, 12 November 2010 11:27:58 UTC