This article has not yet been verified against Umbraco 8.
The concepts and code examples might not work if you are running Umbraco 8.0 or a later version. If you are using Umbraco 7, this article is perfect for you!
You are more than welcome to report any issues found on the Documentation Issue Tracker.
EmbeddedMedia.config
/config/EmbeddedMedia.config
This configuration file lists the Embedded Media Providers configured for use in your Umbraco site.
Providers
Each Embedded Media Provider is listed as a provider element. The provider configuration maps the Url of the 'resource to embed' to the code responsible for embedding that type of resource, using a regular expression.
Anatomy of the configuration
<provider name="YourEmbedProvider" type="YourEmbedNamespace.YourOEmbedClass, YourDllName"> <urlShemeRegex><![CDATA[yourregextomatchyourproviderwebsite\.com/]]></urlShemeRegex> <apiEndpoint><![CDATA[https://www.yourproidersoembedurl.com/oembed]]></apiEndpoint> <requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, umbraco"> <param name="format">xml</param> </requestParams> </provider> provider name- each provider should have a unique nameprovider type- the 'type' of the code that provides the implementation, eg. "YourEmbedNamespace.YourOEmbedClass, YourDllName"urlShemeRegex- The regex to match the url entered by the editor to the specific providerapiEndPoint- Used with the generic Umbraco oEmbed providers, sets the url of the oEmbed endpoint to use for the providerrequestParams- Used with the generic Umbraco oEmbed providers, sets the type of the method responsible for sending additional querystring parameters to the embed Url, there are two methods provided:- Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, umbraco
- Umbraco.Web.Media.EmbedProviders.Settings.String, umbraco
Example configuration
<!-- Youtube Settings --> <provider name="Youtube" type="Umbraco.Web.Media.EmbedProviders.OEmbedVideo, umbraco"> <urlShemeRegex><![CDATA[youtu(?:\.be|be\.com)/(?:(.*)v(/|=)|(.*/)?)([a-zA-Z0-9-_]+)]]></urlShemeRegex> <apiEndpoint><![CDATA[https://www.youtube.com/oembed]]></apiEndpoint> <requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, umbraco"> <param name="iframe">1</param> <param name="format">xml</param> <param name="scheme">https</param> </requestParams> </provider> The provider for YouTube is using the generic OEmbedVideo provider, matches a variety of youtube.com urls, and passes several parameters to the request.
Check out the /config/embeddedmedia.config file for more examples.
Custom Embedded Media Providers
More information about creating your own Custom Embedded Media Providers can be found here