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.
All you need to do to embed material from one of the supported providers is to add a link to it. The plugin will contact the provider and use the appropriate code to add it to the page, e.g. add an iframe for videos and the like.
%EMBED{"url" [width="..." height="..."]}%
(or %OEMBED{...}%
)
url
: an external link to the resource to be embedded
width
, height
: optional maximum values for the image/video/... being embedded (note: not all providers properly implement these parameters)
format
: a format string to implement a custom renderer
template
: the name of a template defined in oembed.tmpl
; known templates shipped with OEmbedPlugin are "article" (todo add more)
quality
(youtube only): specify the thumbnail quality; possible values are hq
, mq
, sd
, default
and auto
; the latter will find out automatically which best thumbnail is available
<custom_key>
: any custom key="value" pair may be defined and made use of in the format (or template) using $custom_key
to expand it; these have higher precendence than the default values submitted by the oembed provider; for example use a custom thumbnail_width="100"
parameter to override the default width.
The keys in the json submitted from the oembed provider can be used in a format string (or a template definition). Some well-known keys are:
$author_name
$author_url
$descriptio
$html
$provider_name
$provider_url
$thumbnail_height
$thumbnail_url
$thumbnail_width
$title
$type
$url
$web_page
$percnt
, $dollar
, $nop
, etc).
See the oembed.tmpl
file on how to use them.
%OEMBED_PROVIDER{["<id>"]}%
id
: provider name to display the configuration for
format
: format string, defaults to 1 [[$provider][$name]
header
: header string added if there was a provider in the list
footer
: footer string added if …
separator
: separator string inserted between each provider found
exampleformat
: format strings for available examples
exampleheader
examplefooter
exampleseparator
include
: regular expression that the provider must match to be included in the output
exclude
: regular expression that the provider must not match to be included in the output
The format string may use the following variables
$name
: name of provider
$examples
: example string constructed from example[format,header,footer,separator]
$provider
: url address of the provider
$api
: api address for the oembed endpoint
$url
: list of patterns that an url must match to be processed by this provider
To display all examples stored in the provider records use:
<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"> *Url*: <input type="text" size="80" name="url" value="%URLPARAM{"url"}%" /> <input type="submit" class="foswikiButton" value="Embed" /> </form> %IF{"$'URLPARAM{url}'!=''" then="$percntEMBED{\"%URLPARAM{"url"}%\"}$percnt" }% %OEMBED_PROVIDER{ format=" 1 $name: $examples" exampleformat="[[%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?url=$url][example]]" }%
%EMBED{"https://www.youtube.com/watch?v=O8e8Ttfz-pY" width="600"}%
%EMBED{"https://soundcloud.com/safia-music/listen-to-soul-listen-to-blues" width="600"}%
%EMBED{"https://www.flickr.com/photos/onement/1239189689/" height="400"}%no response from url
cd /path/to/foswiki perl tools/extension_installer <NameOfExtension> installIf you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Name | Version | Description |
---|---|---|
Moo | >=0 | Required |
Regexp::Assemble | >=0 | Required |
Foswiki::Contrib::CacheContrib | >=0 | Required |
05 May 2022 | added a few more oembed providers |
03 Mar 2021 | adedd microsoft stream provider |
22 Jan 2020 | imported provider from https://github.com/iamcal/oembed; implemented %OEMBED_PROVIDER |
13 Mar 2019 | document quality parameter when embeding youtube videos; added quality="auto" to fetch the best thumbnail available; added support for proxy |
25 Sep 2017 | added clearCache REST interface for local cache maintenance |
17 Nov 2016 | more providers; converted Web::oEmbed from Any::Moose to Moo |
07 Oct 2015 | multiple providers went in & out |
16 Mar 2015 | added Infogram |
23 Feb 2015 | added a few more provider |
16 Dec 2014 | have an image preview for vimeo and youtube and only embed the real video when clicking on it; added Vine |
25 Sep 2014 | added caching |
24 Sep 2014 | added a custom renderer for youtube videos |
29 Aug 2014 | removed my opera, qirk and urtak; use https whereever possible |
01 Nov 2013 | added more providers |
30 Aug 2013 | added more providers |
24 Jun 2013 | added format, template and custom params; added a few more providers |
Author | Michael Daum |
Version | 7.00 |
Release | 05 May 2022 |
Description | Easy embedding of third party content |
Repository | https://github.com/foswiki/OEmbedPlugin |
Copyright | © 2013-2022 Michael Daum |
License | GPL (Gnu General Public License) |
Home | Foswiki:Extensions/OEmbedPlugin |
Support | Foswiki:Support/OEmbedPlugin |