The document discusses oEmbed, an open standard for embedding third-party media content on websites. It describes how oEmbed works, lists major oEmbed providers and consumers, and details the oEmbed specification. The document also introduces oembed-provider-engine, a Ruby gem that allows Rails applications to serve as oEmbed providers by describing how media items can be represented in the oEmbed response format. Areas for future improvement to oembed-provider-engine are also outlined.
Bhubaneswar Call Girls 8250077686 Service Offer VIP Hot Model
oEmbed (on rails)
1. oEmbed
on rails
Kerstin Puschke
Ruby Usergroup Hamburg
January 2013
K. Puschke (Ruby Usergroup HH) oembed January 2013 1 / 17
2. License
CC BY-SA 3.0
Creative Commons
Attribution ShareAlike 3.0
http://creativecommons.org/licenses/by-sa/3.0/
K. Puschke (Ruby Usergroup HH) oembed January 2013 2 / 17
3. Who am I
software engineer at XING
K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17
4. Who am I
software engineer at XING
perl and rails
K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17
5. Who am I
software engineer at XING
perl and rails
@titanoboa42 on twitter
K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17
6. Who am I
software engineer at XING
perl and rails
@titanoboa42 on twitter
titanoboa on github
K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17
7. Who am I
software engineer at XING
perl and rails
@titanoboa42 on twitter
titanoboa on github
titanoboa on stackoverflow
K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17
8. third-party media embedding
Automated third-party media embedding
turn a url into an embedded representation of the resource
e.g. magically display embedded video instead of link
K. Puschke (Ruby Usergroup HH) oembed January 2013 4 / 17
9. third-party media embedding
screenscraping is a maintenance nightmare
K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17
10. third-party media embedding
screenscraping is a maintenance nightmare
provider specific APIs:
additional effort for each additional provider
K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17
11. third-party media embedding
screenscraping is a maintenance nightmare
provider specific APIs:
additional effort for each additional provider
oEmbed standardizes embedding
K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17
12. oEmbed
open embed format
K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17
13. oEmbed
open embed format
open web standard for third-party media embedding
K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17
14. oEmbed
open embed format
open web standard for third-party media embedding
specs published in 2008
K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17
15. oEmbed
open embed format
open web standard for third-party media embedding
specs published in 2008
by Leah Culver (Pownce), Cal Henderson (Flickr), Mike Malone
(Pownce), and Richard Crowley (OpenDNS)
K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17
16. oEmbed providers
youtube
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
17. oEmbed providers
youtube
vimeo
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
18. oEmbed providers
youtube
vimeo
flickr
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
19. oEmbed providers
youtube
vimeo
flickr
twitter
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
20. oEmbed providers
youtube
vimeo
flickr
twitter
slideshare
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
21. oEmbed providers
youtube
vimeo
flickr
twitter
slideshare
speakerdeck
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
22. oEmbed providers
youtube
vimeo
flickr
twitter
slideshare
speakerdeck
intermediaries, e.g. embed.ly
K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17
23. oEmbed consumers
drupal
K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17
24. oEmbed consumers
drupal
wordpress
K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17
25. oEmbed consumers
drupal
wordpress
elgg
K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17
26. oEmbed consumers
drupal
wordpress
elgg
diaspora
K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17
27. oEmbed consumers
drupal
wordpress
elgg
diaspora
xing
K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17
28. oEmbed spec
http GET request to API endpoint with query param url
K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17
29. oEmbed spec
http GET request to API endpoint with query param url
optional additional params: maxwidth, maxheight, format
K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17
30. oEmbed spec
http GET request to API endpoint with query param url
optional additional params: maxwidth, maxheight, format
response format xml or json
K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17
31. oEmbed spec
http GET request to API endpoint with query param url
optional additional params: maxwidth, maxheight, format
response format xml or json
informs consumer how to embed, e.g. gives html snippet
K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17
33. Example response: photo
{ "type": "photo",
"title": "Ba...
"author_name": "...
"author_url": "http://www.flickr.com/photos/...
"width": "1024",
"height": "768",
"url": "http://farm4.staticflickr.com/3040/2362...
"web_page": "http://www.flickr.com/photos/be...
"thumbnail_url": "http://farm4.staticfli...
"thumbnail_width": 75,
"thumbnail_height": 75,
"web_page_short_url": "http://flic.kr/p/4...
"license": "All Rights Reserved",
"version": "1.0",
"cache_age": 3600,
"provider_name": "Flickr",
K. Puschke (Ruby Usergroup HH) oembed January 2013 11 / 17
34. oEmbed gems
quite a few consumer gems
K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17
35. oEmbed gems
quite a few consumer gems
oembed-provider (rails 2 only)
K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17
36. oEmbed gems
quite a few consumer gems
oembed-provider (rails 2 only)
oembed-provider-engine (rails 3 only)
mountable rails 3 engine, heavily based on oembed-provider
K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17
37. oembed-provider-engine
turning your app into an oEmbed provider
mount OembedProviderEngine::Engine in routes.rb
to provide route to API endpoint
K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17
38. oembed-provider-engine
turning your app into an oEmbed provider
mount OembedProviderEngine::Engine in routes.rb
to provide route to API endpoint
your media item’s model
K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17
39. oembed-provider-engine
turning your app into an oEmbed provider
mount OembedProviderEngine::Engine in routes.rb
to provide route to API endpoint
your media item’s model
needs a method for each field to be part of the oEmbed response,
e.g.
html, thumbnail_url,. . .
K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17
40. oembed-provider-engine
turning your app into an oEmbed provider
mount OembedProviderEngine::Engine in routes.rb
to provide route to API endpoint
your media item’s model
needs a method for each field to be part of the oEmbed response,
e.g.
html, thumbnail_url,. . .
include OembedProviderEngine::OembedProvidable
K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17
41. oembed-provider-engine
turning your app into an oEmbed provider
mount OembedProviderEngine::Engine in routes.rb
to provide route to API endpoint
your media item’s model
needs a method for each field to be part of the oEmbed response,
e.g.
html, thumbnail_url,. . .
include OembedProviderEngine::OembedProvidable
call oembed_providable_as with media type, e.g.
oembed_providable_as :video
K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17
42. oembed-provider-engine
inner workings
oembed_providable_as creates scoped OembedResponse
model, e.g. MediaItem::OembedResponse
K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17
43. oembed-provider-engine
inner workings
oembed_providable_as creates scoped OembedResponse
model, e.g. MediaItem::OembedResponse
response model has attributes for each field to be included into
the response
K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17
44. oembed-provider-engine
inner workings
oembed_providable_as creates scoped OembedResponse
model, e.g. MediaItem::OembedResponse
response model has attributes for each field to be included into
the response
its initializer sets attributes to the respective values from the app’s
media item
K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17
45. oembed-provider-engine
inner workings
oembed_providable_as creates scoped OembedResponse
model, e.g. MediaItem::OembedResponse
response model has attributes for each field to be included into
the response
its initializer sets attributes to the respective values from the app’s
media item
has methods to format the response
K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17
47. oembed-provider-engine
inner workings
API endpoint routes to engine’s controller
param url parsed to determine media item model
K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17
48. oembed-provider-engine
inner workings
API endpoint routes to engine’s controller
param url parsed to determine media item model
media item object initialized
scoped response model created (if not already existing)
K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17
49. oembed-provider-engine
inner workings
API endpoint routes to engine’s controller
param url parsed to determine media item model
media item object initialized
scoped response model created (if not already existing)
response object initialized
K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17
50. oembed-provider-engine
inner workings
API endpoint routes to engine’s controller
param url parsed to determine media item model
media item object initialized
scoped response model created (if not already existing)
response object initialized
response formatted and returned
K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17
51. oembed-provider-engine
todo
still very rails 2-ish :-( needs polishing
K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17
52. oembed-provider-engine
todo
still very rails 2-ish :-( needs polishing
proper handling of authorization
K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17
53. oembed-provider-engine
todo
still very rails 2-ish :-( needs polishing
proper handling of authorization
caching
K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17
54. oembed-provider-engine
todo
still very rails 2-ish :-( needs polishing
proper handling of authorization
caching
improve test coverage, maybe migrate from shoulda to rspec
K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17
55. oembed-provider-engine
todo
still very rails 2-ish :-( needs polishing
proper handling of authorization
caching
improve test coverage, maybe migrate from shoulda to rspec
allow for custom fields to be added to the response
K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17
56. Feedback & Co
Questions, comments,. . .
twitter: @titanoboa42
K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17
57. Feedback & Co
Questions, comments,. . .
twitter: @titanoboa42
email: kerstin.puschke@xing.com
K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17
58. Feedback & Co
Questions, comments,. . .
twitter: @titanoboa42
email: kerstin.puschke@xing.com
github: https://github.com/xing/oembed_provider_engine
. . . we are happy to accept pull requests
K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17