Using oEmbed with Known Providers

Using oEmbed is quick and easy. In the typical implementation, your end user would enter a URL as plain text, among other text. For example, we do this all of the time in online text editors, such as the FCKeditor or RadEditor. For example, they'd add a YouTube URL like so:

Entering the URL alone would usually not do anything all on it's own. However, when you use the oEmbed API, the URL will "automagically" be turned into the video found at the preceding URL. The magic part only happens for the end-user, not you. :P

You would parse the input from the end-user to pull the URL, and then run code similar to this:

Dim objYouTube As New WillStrohl.API.oEmbed.Providers.YouTube
Dim strVideo As String
strVideo = objYouTube.GetVideo("", 500, 350)

Or, using the open REST call of the API, you would:

Dim ctlEmbed As New WillStrohl.API.oEmbed.Wrapper
Dim objRequest As New WillStrohl.API.oEmbed.RequestInfo
objRequest.URL = ""
objRequest.MaxWidth = 500
objRequest.MaxHeight = 350

Dim strVideo As String
strVideo = ctlEmbed.GetVideoContent("", objRequest)

Either way, the code that gets returned, and rendered is the same:

<object width="425" height="344">
    <param name="movie" value=""></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed src="" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed>

Last edited Sep 16, 2011 at 1:00 AM by hismightiness, version 4


No comments yet.