Update Gallery API editor's draft
authorJungkee Song <jungkee.song@samsung.com>
Wed, 27 Jun 2012 11:07:53 +0900
changeset 124 cecfc8b99650
parent 123 519c13e6df24
child 125 29d23bcac5ee
Update Gallery API editor's draft
gallery/Overview.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gallery/Overview.html	Wed Jun 27 11:07:53 2012 +0900
@@ -0,0 +1,520 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Pick Media Intent</title>
+    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
+    <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
+    <script type="text/javascript" class='remove'>
+        var respecConfig = {
+              specStatus: "ED",
+              shortName: "gallery-api",
+              editors: [{
+                        name: "송정기(Jungkee Song)", 
+                        url: "", 
+                        company: "Samsung Electronics Co., Ltd.", 
+                        companyURL: "http://www.samsung.com/sec/"},
+                        {name: "이원석(Wonsuk Lee)",
+                        url: "http://wonsuk73.com/", 
+                        company: "Samsung Electronics Co., Ltd.", 
+                        companyURL: "http://www.samsung.com/sec/"}
+                      ],
+              // previousPublishDate:  "2012-05-02",
+              // edEnd:  "",
+              // previousMaturity: "ED",
+              edDraftURI: "http://w3c-test.org/2009/dap/gallery/",
+              wg:           "Device APIs Working Group",
+              wgURI:        "http://www.w3.org/2009/dap/",
+              wgPublicList: "public-device-apis",
+              wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
+          };
+    </script>
+  </head>
+  <body>
+    <section id='abstract'>
+      <p>
+        The Pick Media Intent defines a Web Intent [[!WEBINTENTS]] that enables
+         access to a user's media gallery from inside a Web application. It 
+         defines both an Intent action/type pair that selects this operation, 
+         and the format of the media data that is returned by services implementing this specification.
+      </p>
+    </section>
+
+    <section id='sotd'>
+      <p>
+        This document recasted the previous pure JavaScript APIs version as an API built using Web Intents, while refining the metadata format based on related media data definitions and practical web-based media services.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h2>Introduction</h2>
+      <p>
+        On account of a number of media applications and services accessed from various devices, users tend to maintain their media data in multiple sources including local stroage of devices and web-based media gallleries. For instance, users upload subset of their photos to several different social media galleries with different metadata. For another example, users collect their favorite audio and video resources in several different media galleries which provide inconsistent metadata attributes one another.
+      </p>
+      <p class="note">
+              A terminology, <b>media object</b>, is used hereunder to denote <b>media data</b> that contain a media content and its related metadata. (See <a>Media</a> dictionary)
+      </p>
+      <p>
+        This specification enables a Web application to have access to a selected subset of user's media objects, obtained from arbitrary services not known to the Web application. The interactions, brokered using Web Intents [[WEBINTENTS]] are designed in order to maximise the user's security and privacy. Media objects may be sourced from a plurality of sources — both online and local to the user's device — so long as those sources are registered as Intent services with the user agent. It defines a common media object format which services use to provide data to Web applications in a consistent and interoperable manner.
+      </p>
+      <p>
+        For a Pick Media Intent request, user permission can be naturally asked by a necessary user authentication process that a service implementer MAY provide. Also, users can determine the result media objects to bring to the client with the searching and selecting functionalities that a service implemeter MAY provide.
+      </p>
+      <p>
+        A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
+        presented for the discretion of both implementers of Pick Media Intent services and recipients of media
+        data (i.e. Web applications).
+      </p>
+      <p>
+        The following code illustrates how to obtain media object from a user's media gallery:
+      </p>
+      <pre class="example highlight">
+        var intent = new Intent({ action:   "http://webintents.org/pick",
+                                  type:     "http://w3.org/type/media",
+                                  extras:   { search: "olympic",
+                                              filters: ["title", "description", "author", "tags"],
+                                              limit: 100 }});
+        navigator.startActivity(intent, mediaOK, mediaFail);
+
+        function mediaOK (mediaObjectArray) {
+            // iterate over the array of media objects to do something useful with them
+        }
+        function mediaFail (err) {
+            // display an error to the user
+        }
+      </pre>
+      <p>
+        When the above code is run, the user would typically be prompted by her user agent to select
+        a service able to pick media objects (there may be several such services, if she has multiple media galleries). Upon selecting a service, she will be presented with an interface enabling her
+        to choose what media objects are returned to the Web application. Upon completing her
+        choice, an array of the media objects would be returned to the Web application in the <code>mediaOK</code>
+        callback.
+      </p>
+    </section>
+
+    <section id='conformance'>
+      <p>
+        There is only one single conformance requirement placed upon the <dfn>user agent</dfn>
+        product: a <a>user agent</a> MUST support Web Intents [[!WEBINTENTS]].
+      </p>
+      <p>
+        The conformance criteria in this specification apply to a single product: the
+        <dfn>Media service</dfn> which exposes a Web Intent service that
+        handles Pick Media Intents as defined in this specification.
+      </p>
+      <p>
+        The data returned by the <a>Media service</a> is described in this specification using [[!WEBIDL]].
+        When this data is provided using JavaScript, then the <a>Media service</a> MUST do so in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h2>Security and Privacy Considerations</h2>
+      <p>
+        The Intent defined in this specification can be used to find media objects from user's media galleries. The media objects, in the form of photos, videos, voice recordings with related metadata, may contain user's private information. The distribution of this information could
+        potentially compromise the user's privacy. A conforming implementation
+        of this specification should provide a mechanism that protects the user's privacy and this mechanism should ensure that no such information is retrievable without the user's express permission.
+      </p>
+      <section>
+        <h2>Privacy considerations for implementers of the Pick Media Intent</h2>
+        <p>
+          A <a>media service</a> should not provide media objects to Web sites without the express
+          permission of the user. Obtaining the user's express permission to access a set of media objects does 
+          not imply that the user has granted permission for the same Web site to access more media objects.
+          A <a>media service</a> should take great care to ensure that the user can clearly see which information
+          is about to be shared, and must not share more information than has been requested by the Web application.
+        </p>
+        <p>
+          A <a>user agent</a> may have prearranged trust relationships with a specific <a>media service</a> 
+          that do not require such user interaction.
+        </p>
+      </section>
+      <section>
+        <h2>Privacy considerations for recipients of media objects</h2>
+        <p>
+          Web sites operators that retrieve media objects using this Intent are denoted as recipients
+          below.
+        </p>
+        <p>
+          Recipients should only request media objects when necessary, and only use the media objects for the task for which it was provided to them.
+        </p>
+        <p>
+          Recipients should dispose of media objects once that task is completed, unless expressly
+          permitted to retain it by the user. Recipients should also take measures to protect this information
+          against unauthorised access. If media objects are stored, users should be allowed to update and
+          delete this information.
+        </p>
+        <p>
+          The recipient of media objects should not retransmit the media objects without the
+          user's express permission. Care should be taken when retransmitting and use of encryption is
+          encouraged.
+        </p>
+        <p>
+          Recipients should clearly and conspicuously disclose the fact that they are collecting media objects,
+          the purpose of the collection, how long the data is retained, how the data is secured, how the data is
+          shared if it is shared, how users can access, update and delete the data, and any other choices that
+          users have with respect to the data. This disclosure should include an explanation of any exceptions to
+          the guidelines listed above.
+        </p>
+        <p>
+          Note that even if a user gives permission to share their media objects this can have serious
+          privacy implications for those parties whose media objects are shared, as they may not wish such sharing to
+          occur. This should be considered by Web applications when requesting and using such information.
+        </p>
+      </section>
+      <section>
+        <h2>Additional implementation considerations</h2>
+        <p>
+          Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are
+          also advised to consider the following aspects that can negatively affect the privacy of their users:
+          in certain cases, users can inadvertently grant permission to disclose their media objects
+          to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
+          previously granted permissions no longer apply as far as the user is concerned. Or the users
+          might simply change their minds.
+        </p>
+        <p>
+          Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
+          measures are a <a>user agent</a>'s responsibility and not prescribed by this specification. However, in
+          designing these measures, implementers are advised to enable user awareness of information sharing, and to
+          provide easy access to user interfaces that enable revocation of permissions that Web applications have to
+          access this Intent.
+        </p>
+      </section>
+    </section>
+
+    <section>
+      <h2>Intent Description</h2>
+      <p>
+        The action for this Intent is <code>http://webintents.org/pick</code>.
+      </p>
+      <p>
+        The type for this Intent is <code>http://w3.org/type/media</code>.
+      </p>
+      <p>
+        When a <a>media service</a> is matched for delivery using these action and type, it
+        MUST respond in one of two ways:
+      </p>
+      <ul>
+        <li>
+          If media objects have been successfully selected for delivery, then a successful payload is returned
+          to the client (using <code>postResult()</code>) matching the data format defined below.
+        </li>
+        <li>
+          If an error of any kind takes place in the service, then an error payload is returned (using
+          <code>postFailure()</code>) matching the error data format defined below. The <a>media service</a>
+          MUST NOT treat the user selecting zero media object or cancelling the service as error conditions.
+        </li>
+      </ul>
+      <section>
+        <h2>Intent Extras</h2>
+        <p>
+          The Pick Media Intent can be instantiated with an <code>extras</code> field that adheres to the 
+          following dictionary.
+        </p>
+        <section>
+          <h2>The <a>MediaIntentExtras</a> dictionary</h2>
+          <p>
+            The <a>MediaIntentExtras</a> dictionary describes the options that the invoker can inform to the service as hints in searching the media objects. None of the fields are mandatory.
+          </p>
+          <dl title='dictionary MediaIntentExtras' class='idl'>
+            <dt>DOMString? search</dt>
+            <dd>
+              A string which provides a hint to the <a>media service</a> to search media objects.
+              The exact manner in which this hint is exploited is entirely up to the <a>media service</a>.
+            </dd>
+            <dt>DOMString[]? filters</dt>
+            <dd>
+              An array of string which contain hints to the <a>media service</a> to the DOMString and DOMString[] fields in the <a>Media</a> dictionary that
+              the Web application prefers to use as search criteria. The <a>media service</a> MAY
+              use the values of the <a>filters</a> to search media objects in the media gallery. If a filter name is provided that the <a>media service</a> does not recognise as a field
+              of the <a>Media</a> dictionary, then it MUST ignore it.
+            </dd>
+            <dt>unsigned long? limit</dt>
+            <dd>
+              By default a <a>media service</a> MAY return as many media objects as the user selects. If <code>limit</code>
+              is specified, the <a>media service</a> MUST NOT return more than <code>limit</code> media objects. The
+              <a>media service</a> SHOULD enforce this limitation in the user interface that it exposes.
+            </dd>
+          </dl>
+        </section>
+      </section>
+    </section>
+    <section>
+      <h2>Data Format</h2>
+      <p>
+        Upon successful invocation, the <a>media service</a> MUST return an array of <a>Media</a> dictionaries.
+      </p>
+      <section>
+        <h2>The <a>Media</a> dictionary</h2>
+        <p>
+          The <a>Media</a> dictionary captures the properties of a media object. The properties defined in this dictionary present the content (URI by default and Blob as option) of the media data and the related metadata. The properties of the dictionary are defined based on the previous work of metadata survey in Media Ontology WG, the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a>, [[MEDIA-ANNOT-REQS]] as well as the common attributes of open APIs provided by typical web-based media services, thereby allowing the data format to be supported across implementations supporting these various media metadata representations.
+        </p>
+        <p>
+          Additional attributes MAY be included according to the provisions detailed in 
+          <a href="#extended-media-properties-and-parameters">Extended Media Properties and Parameters</a>.
+        </p>
+        <dl title='dictionary Media' class='idl'>
+          <dt>MediaContent content</dt>
+          <dd>
+            A dictionary containing a URI to the content of the media resource. It optionally contains a Blob of the content.
+          </dd>
+          <dt>DOMString description</dt>
+          <dd>
+            The text description of the content of the media resource.
+          </dd>
+          <dt>DOMString? id</dt>
+          <dd>
+            <p>
+            A URI identifying a media resource.
+            </p>
+            <p class="note">
+              The property, identifier, defined in the core set of [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>] can be considered as a representation format.
+            </p>
+          </dd>
+          <dt>DOMString title</dt>
+          <dd>
+            The title or name given to the media resource.
+          </dd>
+          <dt>DOMString type</dt>
+          <dd>
+            The MIME type of the media resource (e.g., image/png, video/*) [[RFC2046]].
+          </dd>
+          <dt>DOMString? author</dt>
+          <dd>
+            The author of the media resource in string.
+          </dd>
+          <dt>DOMString? category</dt>
+          <dd>
+            The category (genre) of the content of the media resource.
+          </dd>
+          <dt>DOMString? copyright</dt>
+          <dd>
+            The copyright statement associated with the media resource.
+          </dd>
+          <dt>DOMString? fileName</dt>
+          <dd>
+            This field's value is not a url, but is the filename (probably not fully qualified, but simply the name of the leaf file) of the resource being passed as assigned by the user. (See <a href="http://www.w3.org/wiki/WebIntents/MIME_Types">WebIntents/MIME Types</a>)
+          </dd>
+          <dt>unsigned long? fileSize</dt>
+          <dd>
+            The size of the content of the media resource.
+          </dd>
+          <dt>Position? location</dt>
+          <dd>
+            The location information related to the content of the media resource. [[GEOLOCATION-API]] 
+          </dd>
+          <dt>DOMString[]? tags</dt>
+          <dd>
+            <p>
+              The array of strings representing series of tag string.
+            </p>
+          </dd>
+          <dt>MediaContent? thumbnail</dt>
+          <dd>
+            A dictionary containing a URI to the thumbnail of the content of the media resource. It optionally contains a Blob of the thumbnail of the content.
+          </dd>
+          <dt>Date? createdDate</dt>
+          <dd>
+            <p>
+              The creation date of the media resource in Date type.
+            </p>
+          </dd>
+          <dt>Date? updatedDate</dt>
+          <dd>
+            <p>
+              The last updated date of the media resource in Date type.
+            </p>
+          </dd>
+          <dt>DOMString? collection</dt>
+          <dd>
+            <p>
+              The name of the collection or album that the media resource belongs to.
+            </p>
+          </dd>
+          <dt>unsigned long? duration</dt>
+          <dd>
+            <p>
+              The actual duration of the resource. The units are defined to be seconds.
+            </p>
+          </dd>
+          <dt>unsigned long? frameRate</dt>
+          <dd>
+            <p>
+              The video frame rate. The units are defined to be frames per second.
+            </p>
+          </dd>
+          <dt>DOMString? language</dt>
+          <dd>
+            <p>
+              The language used in the media resource.
+            </p>
+          </dd>
+          <dt>unsigned long? likeCount</dt>
+          <dd>
+            <p>
+              The count of the vote in favor of the media resource.
+            </p>
+          </dd>
+          <dt>float? rating</dt>
+          <dd>
+            <p>
+              The rating value (e.g., customer rating, review, audience appreciation) of the media resource.
+            </p>
+          </dd>
+          <dt>unsigned long? ratingCount</dt>
+          <dd>
+            <p>
+              The number of ratings made on the media resource.
+            </p>
+          </dd>
+          <dt>DOMString? resolution</dt>
+          <dd>
+            <p>
+              The frame size of the resource (e.g., width and height of 720 and 480 in px is represented as 720*480+px).
+            </p>
+            <p class="note">
+              If the usage of this property is frequent, a seperate dictionary can be defined refering to frameSize property defined in [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>]
+            </p>
+          </dd>
+          <dt>unsigned long? samplingRate</dt>
+          <dd>
+            <p>
+              The audio sampling rate. The units are defined to be samples per second.
+            </p>
+          </dd>
+          <dt>Date? publishedDate</dt>
+          <dd>
+            <p>
+              The publishing date of the media resource in Date type.
+            </p>
+          </dd>
+          <dt>DOMString? publisher</dt>
+          <dd>
+            <p>
+              The publisher of the media resource.
+            </p>
+          </dd>
+          <dt>unsigned long? viewCount</dt>
+          <dd>
+            <p>
+              The access count made on the media resource.
+            </p>
+          </dd>
+        </dl>
+      </section>
+
+      <section>
+        <h2>The <a>MediaContent</a> dictionary</h2>
+        <p>
+          The <a>MediaContent</a> dictionary describes a media content reference in detail.
+        </p>
+        <dl title='dictionary MediaContent' class='idl'>
+          <dt>DOMString uri</dt>
+          <dd>
+            The URI to the content of the media resource. This attribute is a mandatory property.
+          </dd>
+          <dt>Blob? blob</dt>
+          <dd>
+            The optional property to contain the media content in Blob format.
+          </dd>
+        </dl>
+      </section>
+
+      <section>
+        <h2>The <a>MeidaError</a> dictionary</h2>
+        <p>
+          If the <a>media service</a> encounters an error then it MUST return an error 
+          (through <code>postFailure()</code>) using the <a>MediaError</a> dictionary.
+        </p>
+        <dl title='dictionary MediaError' class='idl'>
+          <dt>DOMString message</dt>
+          <dd>A message describing the error.</dd>
+        </dl>
+      </section>
+      <section>
+        <h2>Extended Media Properties and Parameters</h2>
+        <p>
+          A <a>media service</a> MAY extend the dictionaries described in in the Data Formats section with
+          additional fields. If providing an extended field, a <a>media service</a> MUST prefix its name
+          with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix.
+        </p>
+      </section>
+    </section>
+    <section class="informative appendix">
+      <h2>Media Service Example</h2>
+
+      <p>
+      This section describes an example usage of the Pick Media Intent in media service. It shows the use of the values delivered through <a>MediaIntentExtras</a> dictionary, and the way to return the result array of media objects through <a>Media</a> dictionary.
+      </p>
+
+      <section>
+        <h3>Accessing <a>MediaIntentExtras</a> Values  - Example #1</h3>
+
+        <p>
+        Media service implementers can retrieve the values delivered in extra field of the intent request. The extra field contains the MediaIntentExtras dictionary:
+        </p>
+        <div class='example'>
+          <pre class="sh_javascript">
+  &lt;script type="text/javascript"&gt;
+  if (window.intent) {
+      var keyword = window.intent.extra.search;  // a string based hint to search
+      var filters = window.intent.extra.filters; // DOMString[] based hint to fields to match
+      var limit = window.intent.extra.limit;     // maximum number of objects to return
+
+      // do search relevant media objects based on the extras
+      var mediaObjectArray = searchMediaobjects(keyword, filters, limit);
+      
+      if (mediaObjectArray) {
+          window.intent.postResult(mediaObjectArray);
+      } else {
+          window.intent.postFailure(errorMessage);
+      }
+  }  
+  &lt;/script&gt;
+          </pre>
+        </div>
+
+        <p>
+        The use of the properties in MediaIntentExtras dictionary is optional. Service implementers can decide whether these properties are to be used as hints for search.
+        </p>
+      </section>
+
+      <section>
+        <h3>Creating Media Object - Example #2</h3>
+
+        <p>
+        Media service implementers can create media objects in the format of the Media dictionary and make an array of media objects to send to client. (using <code>postResult()</code>):
+        </p>
+
+        <div class='example'>
+          <pre class="sh_javascript">
+  &lt;script type="text/javascript"&gt;
+  if (window.intent) {
+      var content = {};
+      content.uri = "http://example.com/gallery/image00001.png";
+       
+      var mediaObject = new Object();
+      mediaObject.content = content;
+      mediaObject.description = "The city view of Seoul";
+      mediaObject.id = ""; 
+      mediaObject.title = "City of Seoul";
+      mediaObject.type = "image/png";  // MIME type of the media content
+      mediaObject.author = "J.";
+
+      var mediaObjectArray = new Array();
+      
+      mediaObjectArray[0] = mediaObject;
+      
+      if (mediaObjectArray) {
+          window.intent.postResult(mediaObjectArray);
+      } else {
+          window.intent.postFailure(errorMessage);
+      }
+  }  
+  &lt;/script&gt;
+          </pre>
+        </div>
+      </section>
+    </section>
+  </body>
+</html>