Embedding

From VZ Developer Wiki
Jump to: navigation, search

VZ-Netzwerke supports OEmbed as a standard to enable external sites to provide content which users can embed into their user generated content. As well es providing OEmbed resources for publicly available data like Brand Profiles, Brand Groups, App Information or Landingpages.

The OEmbed protocal is fairly simple and described in depth at http://oembed.com/.

VZ as OEmbed Provider

The VZ OEmbed endpoints are:

Or if you want to get HTTP Error Codes instead of a human readable OEmbed Error response:

The following resources are currently publicly resolved:

  • public brand profiles (type 'rich', schema /vz.net\/Profile/.*/)
  • public brand groups (type 'rich', schema /vz.net\/Groups/Overview/.*/)
  • public landing pages (type 'rich', schema /vz.net\/l/.*/)
  • public gadget information boxes (type 'rich', schema /vz.net\/Gadgets/Info/.*/)
  • public gadget information boxes (type 'rich', schema /vz.net\/Gadgets/Install/.*/)

Since we support short urls with the schema /vz.net\/.* you should also add the following URL schemas in your library:

  • /meinvz.net\/[a-zA-Z0-9\-\_]*$/
  • /studivz.net\/[a-zA-Z0-9\-\_]*$/
  • /schuelervz.net\/[a-zA-Z0-9\-\_]*$/

We currently do not support auto discovery for OEmbed.

Examples

public profile with short url
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2Fstromberg
public profile
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2FProfile%2FLrpFZNiGFUa0Z4KNR7UiWO-aTfUFhVpKiBdv6V8EiDI
public group
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2FGroups%2FOverview%2F3641f40e638482bd
landing page
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2Fl%2Fapps
gadget info box
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2FGadgets%2FInfo%2F489
JSON format
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2Fstromberg&format=json
XML format
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2Fstromberg&format=xml
JSONP format with callback
http://www.studivz.net/Link/OEmbed/?url=http%3A%2F%2Fwww.studivz.net%2Fstromberg&format=json&callback=cb

VZ as OEmbed Client

VZ-Netzwerke uses a White-Listing for services which are permitted to embed content. If you want your site registered as an OEmbed provider you have to meet the following technical requirements:

  • You have to support JSON as response format
  • You have to respect a given callback parameter and return a correct JSONP response if it is given (see http://en.wikipedia.org/wiki/JSON#JSONP)
  • You have to return one of the following OEmbed response types: Photo, Video, Rich
  • You have to respect the maxwidth and maxheight parameters
  • If your content includes a video, sound or any other animation, it must not autoplay but only start after a click by the user.
  • For best integration into the VZ grapevine you should also return a thumbnail_url if available

Please contact our partner support for further details on how to register your website as an OEmbed provider for VZ-Netzwerke: [[1]]

Implementation

Implementing OEmbed for your site is easy. Basically you just have to provide a public OEmbed endpoint. This endpoint gets the URL of the actual resource passed as a parameter and has to return a JSON or XML object with the content which should be embedded.

Example

A very simple OEmbed backend code could look like this:

$url = $_GET['url'];
$callback = $_GET['callback'];

$urlPath = parse_url($url, PHP_URL_PATH);

$response = array(
   'type' => 'rich',
   'html' => 'You called ' . $urlPath,
   'width' => 50,
   'height' => 10,
);

header('Content-Type: application/json');

echo $callback . '(' . json_encode($response) . ')';

This means that a request like

 http://yoursite/oembed?url=yoururl&callback=cb

would result in the response:

cb({
   type: 'rich',
   html: 'You called yoururl',
   width: 50,
   height: 10
})

List of white-listed services

Currently we support the following services on our platforms:

schülerVZ, studiVZ and meinVZ:

  • VZ profiles
  • VZ groups
  • VZ photos
  • VZ albums
  • VZ apps
  • VZ landing pages
  • Flickr
  • Myspace Video
  • Twitter
  • Twitpic
  • Yahoo Video
  • Youtube
  • Wikipedia
  • 3min.de
  • 5min.com
  • IMDB
  • QIK
  • Revision3
  • Screenr
  • SlideShare
  • Deezer
  • VZLog
  • Cometro
  • Yfrog
  • Soundcloud
  • Scribd
  • Mobypicture
  • Twitgoo
  • img.ly
  • MobyPicture
  • Facebook Photos
  • gist.github.com
  • Content1.de

studiVZ and meinVZ only:

  • Clipfish
  • MyVideo
  • Sevenload
  • Vimeo
  • BlipTV
  • Metacafe
  • Viddler
  • Veoh
  • UStream