W3C

The Gallery API

W3C Editor's Draft 02 May 2012

This version:
http://dev.w3.org/2009/dap/gallery/
Latest published version:
http://www.w3.org/TR/gallery/
Latest editor's draft:
http://dev.w3.org/2009/dap/gallery/
Previous version:
none
Editors:
송정기(Jungkee Song), Samsung Electronics Co., Ltd.
이원석(Wonsuk Lee), Samsung Electronics Co., Ltd.

Abstract

This specification defines a mechanism to pick and search media (image, video, audio) contents along with related metadata from media galleries.

This specification uses Web Intents to find and locate the registered galleries.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document was published by the Device APIs Working Group as an Editor's Draft. If you wish to make comments regarding this document, please send them to public-device-apis@w3.org (subscribe, archives). All feedback is welcome.

Publication as an Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key words must, must not, required, should, should not, recommended, may, and optional in this specification are to be interpreted as described in [RFC2119].

2. Introduction

This section is non-normative.

The Gallery API defines a high-level interface for accessing media gallery located on the device. A media gallery is a collection of media objects such as video, audio and image.

To achieve the simplicity in the browser level context, this specification defines only the read-only functionalities.

2.1 Usage Examples

The following code shows how to work with the gallery API.

Example of a image gallery service. The code registers a pick action for image pick service:

<html>
<head>
<meta charset='utf-8' />
<title>Image Gallery Service</title>
<intent action=”http://webintents.org/pick” 
	type=”image/*” 
	href=”http://example.org/ImageService/” 
	title=”Example Image Service” />
</head>
			

A web application start a Web Intent request to pick images from registered galleries.

// Client-ends request media service using Web Intents pick action
// The request of image pick service

var intent = new Intent({
                        action: "http://webintents.org/pick",
                        type: "image/*",
                        extras: { filter: { name: "Seoul" }, multiple: true }
                        });
                        
navigator.startActivity(intent, galleryResponse);

function galleryResponse(data) {
    // Parse data encoded in an array of objects
}

Example of a video gallery service. The code registers a pick action for video pick service:

<html>
<head>
<meta charset='utf-8' />
<title>Video Gallery Service</title>
<intent action=”http://webintents.org/pick” 
	type=”video/*” 
	href=”http://example.org/VideoService/” 
	title=”Example Video Service” />
</head>
			

A web application start a Web Intent request to pick videos from registered galleries.

// Client-ends request media service using Web Intents pick action
// The request of video pick service

var intent = new Intent({
                        action: "http://webintents.org/pick",
                        type: "video/*",
                        extras: { filter: { name: "Family" }, multiple: true }
                        });
                        
navigator.startActivity(intent, galleryResponse);

function galleryResponse(data) {
    // Parse data encoded in an array of objects
}

Example of a audio gallery service. The code registers a pick action for audio pick service:

<html>
<head>
<meta charset='utf-8' />
<title>Audio Gallery Service</title>
<intent action=”http://webintents.org/pick” 
	type=”audio/*” 
	href=”http://example.org/AudioService/” 
	title=”Example Audio Service” />
</head>
			

A web application start a Web Intent request to pick audios from registered galleries.

// Client-ends request media service using Web Intents pick action
// The request of audio pick service

var intent = new Intent({
                        action: "http://webintents.org/pick",
                        type: "audio/*",
                        extras: { filter: { name: "Love" }, multiple: true }
                        });
                        
navigator.startActivity(intent, galleryResponse);

function galleryResponse(data) {
    // Parse data encoded in an array of objects
}

Mediaobject (ImageObject, VideoObject and AudioObject) in schema.org might be used as type in case Web Intents specification adopts it.

Callback gets an array of objects, data, describing the content. Objects in data, in addition to other metadata fields, have either a url or a content field that would contain a Blob (i.e. the media content.)

3. API Description

3.1 MediaObject dictionary

The MediaObject dictionary exposes an object to deliver media contents and related metadata from web galleries and local galleries.

The metadata of the media contens and the search filters are to be defined.

dictionary MediaObject {
    readonly attribute any    content;
};

3.1.1 Dictionary MediaObject Members

the content of the media object.

3.2 Discussion

This section is only for dicussion and will be deleted.

Content delivery method:

Which is a better way, using a url or a blob?

extra attribute in Web Intents request

When extra attribute is not given, the request is regarded a search for everything and pick just one; when extra is given, the request is regarded as a specific content search.

multiple attribute in extra parameter:

When set to true, mutiple attribute in extra paramenter means a client wants to retrieve contents from multiple media sources. Search filter should filter what the user sees in the picker, and the user still decides what is returned (which can be everything of course).


4. Use Cases and Requirements

4.1 Use Cases

Picking image:

A user picks an image or a set of images either from web galleries (e.g. Flickr, Piscasa, etc.) or from local gallery.

Picking video:

A user picks a video or a set of videos either from web galleries (e.g. YouTube, DailyMotion, etc.) or from local gallery.

Picking audio:

A user picks an audio or a set of audio either from web galleries (e.g. SoundCloud, Last.fm, etc.) or from local gallery.


Advantage: it makes integrating with popular services like Flickr, Youtube, SoundCloud a lot easier.

4.2 Requirements

The Gallery API:

  • must provide the ability to list the galleries from available sources (e.g. local storage, memory card and web services such as Flickr, YouTube, SoundCloud, etc.) – by Web Intents
  • must provide the ability to enumerate the media objects in the designated gallery.
  • must provide the ability to filter the media objects in the designated gallery. i.e. finding content inside a gallery (e.g. date, title, geolocation, etc.)
  • must provide the ability to retrieve the metadata of the media objects in the gallery (the metadata format is to be defined later through e.g. the MediaObjects in schema.org or the model in JS, etc.)

B. Features for Future Consideration

This is a list of features that have been discussed with respect to this version of the API but for which it has been decided that if they are included it will be in a future revision.

  • ...

C. Acknowledgements

Many thanks to Robin Berjon for making our lives so much easier with his cool tool.

D. References

D.1 Normative references

[A Blob URI]
Arun Ranganathan; Jonas Sicking. A Blob URI. 20 October 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/FileAPI/#creating-revoking
[Web Intents]
Greg Billock; James Hawkins; Paul Kinlan. Web Intents. 27 April 2012. W3C Editor's Draft. (Work in progress.) URL: http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html

D.2 Informative references

No informative references.