[whatwg] metadata attribute for media

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Mon Jun 11 18:57:41 PDT 2012


On Tue, Jun 12, 2012 at 7:53 AM, Ralph Giles <giles at mozilla.com> wrote:
> Recently, we've been considering adding a 'tags' or 'metadata' attribute
> to HTML media elements in Firefox, to allow webcontent access to
> metadata from the playing media resource. In particular we're interested
> in tag data like creator, title, date, and so on.
>
> My recollection is that this has been discussed a number of times in the
> past, but there was never suffient motivation to support the interface.
> Our particular motivation here is webapps that present a media file
> library. While it's certainly possible to parse the tag data out
> directly with javascript, it's more convenient if the HTML media element
> does so, and the underlying platform decoder libraries usually provide
> this data already.
>
> As such I wanted to raise the issue here and get design feedback and
> levels of interest for other user agents.
>
> Here's a first idea:
>
> partial interface HTMLMediaElement {
>  readonly attribute object tags;
> };
>
> Accessing media.tags provides an object with a key: value data, for example:
>
> {
>  'title': 'My Movie',
>  'creator': 'This User',
>  'date': '2012-06-18',
>  'license': 'http://creativecommons.org/licenses/by-nc-sa/'
> }
>
> The keys may need to be filtered, since the files can contain things
> like base64-encoded cover art, which makes the object prohibitively
> large. The keys may need to be mapped to some standard scheme (i.e.
> dublic core) since vocabularies vary from format to format.
>
> This is nice because it's easy to access, can be simply enumerated,
> and extensible. Which is helpful when if gets added the <img> for exif data.


Did you know that the W3C media annotations WG has specified such an
API in http://www.w3.org/TR/2011/WD-mediaont-api-1.0-20111122/#api-description
. Essentially, their suggestion is to add the following IDL functions:

void getMediaProperty (DOMString[] propertyNames, PropertyCallback
successCallback, ErrorCallback errorCallback, optional DOMString
fragment, optional DOMString sourceFormat, optional DOMString
language);

void getOriginalMetadata (DOMString sourceFormat, MetadataCallback
successCallback, ErrorCallback errorCallback);


I actually think their API is too complicated and prefer your simple
approach. Returning a JSON object also allows hierarchical tags to be
returned in a structured way, which is nice. You lose the
normalisation that the W3C media ann WG has worked on across different
media resources, but that normalisation can always be done on top of
the JSON objects that your API returns.


Cheers,
Silvia.



More information about the whatwg mailing list