Monday, July 7, 2008

Active resource representations - aka OEmbed

(Note: this isn't a jabber-only posts, although one of the earliest implementations is in Google Talk Gadget, and the jabber community could benefit from this in general)

PHP-OEmbed project page

Remember when the newly introduced Google Talk Gadget displayed Youtube videos instead of showing their links? That's what I call "active resource representation", because it represents the given video more [inter]actively than the pure link - which is hardly showing anything in the case of youtube.

I believe that a resource usually can be equally represented in a small place: there's no need to load a full page to view a youtube video or a flickr photo, but there isn't need for it to look at a person's social network profile, to accept/reject a calendar invitation, etc - and all of these have URLs nowadays. These technologies could be used in e-mail systems, forums, and chat clients.

What OEmbed does, is that it tries to provide metadata about a certain resource found at the given URL. That is: you send the link of a flickr photo, and you get an XML or JSON-formatted structure back. While it can be argued, that these could be / should be / in an ideal world, would be solved by HTTP headers, this is not the case, and this solution isn't as bad.

I tried to do a server-side PHP framework, which talks the OEmbed protocol for clients to consume, however, it makes you be able to create non-oembed compatible wrappers too (the perfect example is youtube, of course). This could be used in a web-client, given that it talks back javascript to you.

Currently, it can handle (proxy) any OEmbed provider (given that you enter their respective address into the providers.xml file), and it has a Youtube provider, which uses some not-so-official part of the "official YouTube Data API". New providers can be added by looking at the provider API - oh, and there's no error handling yet, so you could understand the code :)

Note: I extended OEmbed protocol a bit, namely:

  • There could be a description field for every OEmbed-entity (handy for tooltips)

  • There could be a duration part (in seconds) for video embeds

  • The original resource URL could be in the data response

Oh, and Flickr: please add thumbnails! Thanks :)


Tix•R•Us said...

The example is broken. It breaks the same way when I implement on my local host. Help fix?

shoppingugg said...

ED clothing
can be bought in many department stores and specialty shops located nationwide. Good thing there is ED Hardy Shoes
. You will simply head on over to our website and check out the selection of ED Hardy Shoes
. hardy shirt
is one of the labels that never become outdated.

Many online pharmacies sell fake or generic lida
. If the doctor approves your form, it means the usage of lida daidaihua
is safe for your use. daidaihua
is based on ancient Chinese formula. The lida slimming
stick to the basic theme. slimming capsule
is purely natural as it is made from plants no acids. The intake of slimming capsules
proves to be a safe obesity treatment option.

longge said...

louis vuitton wallets are practically indestructible: This requires little explanation for a true bag lover – even people that aren’t louis vuitton wallet fans know that louis vuitton replica handbags are historically very well-made, particularly the traditional styles.