Wednesday, May 28, 2008

Thoughts on Embedding

Recently, during one of my long runs up and down the tortuous hills of San Francisco, the thought occurred to me that we have a lot of content being shared between sites. There is an increasing desire to host content from one application inside of another. One solution that sites like YouTube have used is the publishing of what is known as an embed code. At the time, I was thinking that it would be interesting to provide a service that could centralize the logic in creating different types of embed codes for different types of services. The concept was to abstract out the processing of embedding content to a higher-level service that I would create. Having come from a very service-oriented coding style at my previous employer, I had my doubts that this would be effective because you are effectively abstracting to another proprietary format. It might be better, but it is kind of more of the same.

Today, at Google I/O, I was approached by a couple of Powncers who were advocating on behalf of a service called OEmbed. It is meant to provide a common way of embedding external content into a given website. It involves introducing a level of abstraction on the consumer side of the embed process whereby a call is made to the content source to get its embed code.

I tend to be highly skeptical of introducing layers of abstraction, hence my rejection of the aforementioned idea that I was kicking around while running. However, in this case, there is an indirection that I think could be extremely powerful, making the abstraction worthwhile. OEmbed requires the content source to translate a given request into a corresponding embed code, alleviating the content container from having to handle the translation itself (which is how sites like Pownce have to do it presently). In this way, content containers can take advantage of a common framework (e.g. OEmbed) to translate certain markup (e.g. hyperlinks to videos) into actual embed codes, and the proprietary logic remains inside the content source.

There is still much I need to research into the concepts of OEmbed, but it generally makes sense to me. Hopefully, I can convince others of this line of thinking and/or help shape it as grows.