Feature summary: Currently it is impossible to share media from Wikimedia Commons directly at external sites (social media, WordPress blogs...), partially because oEmbed is not supported by us. If we want to be "the central repository of free knowledge" we must be able to share media directly, without need of third party sites.
Use case(s) :
- Quickly share/embed videos or audio from Commons in external sites.
- Embed videos at WordPress blogs directly (as it already works with Vimeo or YouTube links) without having to touch HTML code
Benefits (why should this be implemented?):
- Being the central repository of free knowledge
- Making Commons more prominent an a real site to share media
- Making our activities less dependant on YouTube (and their advertisements)
- Improving the process, as we only need to upload the media once if we want to share it
- Wikimedia Commons contributors will have more correct credits to their contributions over the Internet, reducing copyright violations
Resources
- https://oembed.com/ - oEmbed specifications
- https://oembed.link/ - oEmbed test page
- e.g. ✅ test it against a random YouTube video like https://www.youtube.com/watch?v=9J62hGda9BQ
- e.g. ❌ test it against a random Wikimedia Commons video like https://commons.wikimedia.org/wiki/File:Swallowtail_Jig_-_Irish_Fiddle_Tune!.webm
See this schema by @valerio.bozzolan (feel free to replace and update - visit the file to see its source code):
Non-Resources
- https://github.com/Cyken-Zeraux/Mediawiki-oEmbed
- ↑ published since 2016 and says that it's not possible to create an oEmbed extension for MediaWiki 🤯 maybe too old and pessimistic
- ...
Triage
(↓ Small triage done during wmhack 2025 by @valerio.bozzolan)
To make this actionable, this can be logically divided in three parts (I think all of them can be done in parallel):
- Rendering: have more support for important content models (difficult)
- ✅ videos: seems covered
- → https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm?embedplayer=1
- Videos can be embedded thanks to extension TimedMediaHandler
- 🫠 NOTE: the HTTP GET parameter embedplayer=1 is a big specialized and not really good to be generalized for images or other pages.
- 🔶 So maybe, for images and text pages: we could introduce a more generic action=embed or similar (?)
- 🔶 anyway, the video parameter can remain as-is indeed, and to standardize others, see point number 3
- → https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm?embedplayer=1
- 🔶 images: ...?
- ❓ is there something already implemented to embed images in an HTML page? (e.g. with title and license credits)
- 🔶 to implement something, we may need extension PageImages who knows thumbnail dimensions (?)
- 🔶 text pages: ...?
- ❓ is there something already implemented to embed a normal page in an HTML page? (e.g. with title and first paragraph and image)
- 🔶 to implement something, we may need extension TextExtract to produce short introductions
- ✅ videos: seems covered
- API: add (seems easy)
- it should be implemented as a REST API not action APIs, to manage JSON (most easiest format required), but also to potentially support XML in the future as bonus point without rewriting everything (action APIs are not really intended to hack the format parameter)
- Backend: embed provider abstraction
- 🔶 NICE TO HAVE: a generic MediaWiki core REST API should be able to easily interrogate the embed feature availability for a generic page, e.g. possibly not hardcoding "is TimedMediaHandler installed?", so that a new API REST could ask "is there anything giving embed support for this page (that is a video)?" and TimedMediaHandler could register to that new hook and reply with something that embeds https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm?embedplayer=1 and with the desired dimensions, etc. (see point 3. generalizing embed support).
- ✅ This is not a blocking point, since in a first prototype we can just check "is TimedMediaHandler installed?" and that would work to know that videos have ?embedplayer=1, to add the "oembed discovery" tag in the HTML there.
Pitfalls
- it's still nowhere clear where this feature should be introduced since it seems it should rely on multiple already-existing extensions, so I would personally encourage the future lazy hacker to go ahead with a little early dirty prototype in the core of MediaWiki, so, creating a prototype to be potentially put in the trash bin later, but veeery useful to quickly highlight absurdities in this path and highlight rabbit holes
- probably a first release should just concentrate on videos (so, relying on the ?embedplayer=1 thing), but this seems not a good reason to expand TimedMediaHandler directly, IMVHO, since the overall goal is also to support also normal images and pages, and it would be confusing to do that in TimedMediaHandler
In short
The page (e.g. the video page) should have this in the HTML (or very similar), pointing to our new REST API to be created:
<link rel="alternate" type="application/json+oembed" href="https://example.com/w/rest.php/oembed/?format=json&url=https%3A%2F%2Fcommons.wikimedia.org%2Fwiki%2FFile%3AThe_Mechanical_Cow_%281927%29.webm" />
So, this REST API should exist:
https://example.com/w/rest.php/oembed/?format=json&url=
Example REST API call:
https://example.com/w/rest.php/oembed/?format=json&url=https%3A%2F%2Fcommons.wikimedia.org%2Fwiki%2FFile%3AThe_Mechanical_Cow_%281927%29.webm
And that REST API should return something like this:
{ "version": "1.0", "type": "video", "provider_name": "Wikimedia Commons", "provider_url": "https://commons.wikimedia.org", "html": "<iframe src=\"https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm?embedplayer=yes\" width=\"512\" height=\"384.9624060150376\" frameborder=\"0\" loading=\"lazy\" allow=\"autoplay; picture-in-picture\" allowfullscreen></iframe>", "width": 512, "height": 384.9624060150376, "title": "The Mechanical Cow (1927)", "url": "https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm" }
So the client can consume the proposed HTML, that is:
<iframe src="https://commons.wikimedia.org/wiki/File:The_Mechanical_Cow_(1927).webm?embedplayer=yes" width="512" height="384.9624060150376" frameborder="0" loading="lazy" allow="autoplay; picture-in-picture" allowfullscreen></iframe>
Then, profit $$$.

