diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 38f43f344f..e0660f8f12 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -178,9 +178,6 @@ Designer - - EmbeddedMedia.config - Designer @@ -300,7 +297,6 @@ Designer - diff --git a/src/Umbraco.Web.UI/config/EmbeddedMedia.Release.config b/src/Umbraco.Web.UI/config/EmbeddedMedia.Release.config deleted file mode 100644 index 442493e3d6..0000000000 --- a/src/Umbraco.Web.UI/config/EmbeddedMedia.Release.config +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - json - - - - - - - - - - - - - - - - - - - - 1 - xml - https - - - - - - - - - - - - - - xml - - - - - - - - xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI/config/EmbeddedMedia.config b/src/Umbraco.Web.UI/config/EmbeddedMedia.config deleted file mode 100644 index a5edaf3834..0000000000 --- a/src/Umbraco.Web.UI/config/EmbeddedMedia.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - 1 - xml - https - - - - - - - - - xml - - - - diff --git a/src/Umbraco.Web/Media/EmbedProviders/DailyMotion.cs b/src/Umbraco.Web/Media/EmbedProviders/DailyMotion.cs new file mode 100644 index 0000000000..78ea0b8662 --- /dev/null +++ b/src/Umbraco.Web/Media/EmbedProviders/DailyMotion.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Umbraco.Web.Media.EmbedProviders +{ + public class DailyMotion : EmbedProviderBase + { + public override string ApiEndpoint => "https://www.dailymotion.com/services/oembed"; + + public override string[] UrlSchemeRegex => new string[] + { + @"dailymotion.com/video/.*" + }; + + public override Dictionary RequestParams => new Dictionary() + { + //ApiUrl/?format=xml + {"format", "xml"} + }; + + public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) + { + var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); + var xmlDocument = base.GetXmlResponse(requestUrl); + + return GetXmlProperty(xmlDocument, "/oembed/html"); + } + } +} diff --git a/src/Umbraco.Web/Media/EmbedProviders/Youtube.cs b/src/Umbraco.Web/Media/EmbedProviders/Youtube.cs new file mode 100644 index 0000000000..7755a36958 --- /dev/null +++ b/src/Umbraco.Web/Media/EmbedProviders/Youtube.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Umbraco.Web.Media.EmbedProviders +{ + public class YouTube : EmbedProviderBase + { + public override string ApiEndpoint => "https://www.youtube.com/oembed"; + + public override string[] UrlSchemeRegex => new string[] + { + @"youtu.be/.*", + @"youtu.be/.*" + }; + + public override Dictionary RequestParams => new Dictionary() + { + //ApiUrl/?format=json + {"format", "json"} + }; + + public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) + { + var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); + var oembed = base.GetJsonResponse(requestUrl); + + return oembed.GetHtml(); + } + } +} diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index 5974288daf..43add0f15e 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -217,22 +217,19 @@ namespace Umbraco.Web.Runtime // register OEmbed providers // no type scanning - all explicit opt-in of adding types composition.WithCollectionBuilder() + .Append() + .Append() + .Append() + .Append() + .Append() .Append() .Append() .Append() .Append() - .Append() - .Append() - .Append() .Append() .Append() .Append() .Append(); - - - //Giphy - //Meetup - //Spotify } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index f9fdb5aabb..8be153889e 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -143,11 +143,13 @@ + +