Knowledge is power. We love to share it.

News related to Mono products, services and latest developments in our community.

denis

Using oEmbed in MonoX

06/26/2011Categories: MonoX

Social media applications are all about sharing - whether it is a nice photo, a hot movie preview or your new blog post. Popular sites like YouTube, Flickr and Vimeo recognized that a long time ago and offered a nice solution to allow users to plug a photo, video or a song (inside a small player or a display wrapper) into your page. Their solution comes in a form of embed codes, strings of HTML code that make it easy for anyone to embed any kind of media content into their sites.
To put it more formally, "oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly."

MonoX now fully supports oEmbed standard. It requires users to enter "embeddable" URLs in the following format:

[you http link goes here]

Square brackets are needed to distinguish the embedded content from the "ordinary" links. While the content is saved, it is parsed for the presence of such links and all of them are replaced with the embed codes received from their target oEmbed providers. You can turn off the oEmbed support on a Web part level.
Major oEmbed providers, as defined in the oEmbed API spec at http://www.oembed.com/, are called directly. All other embedded links are transformed by calling the popular service called Embed.ly as it wraps more than 200 less known providers.
The support for oEmbed is included in the MonoX social wall textbox and all HTML editors (main MonoXHtmlEditor and the RadCustomEditor that is a part of blog and discussion controls).

It is easy to use the oEmbed providers from your custom Web parts. Just call the following method and pass the content to be parsed to it:

MonoSoftware.MonoX.oEmbed.Embedder().EmbedContent(string contentToParse)

A simple and elegant solution for many content sharing scenarios, isn't it?

Rated 5.00, 2 vote(s).