Adds a few more providers to the collection

This commit is contained in:
Warren Buckley
2019-01-30 16:50:08 +00:00
parent 74dcaea879
commit 880faeebd3
8 changed files with 80 additions and 39 deletions

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Umbraco.Web.Media.EmbedProviders
{
public class Soundcloud : EmbedProviderBase
{
public override string ApiEndpoint => "https://soundcloud.com/oembed";
public override string[] UrlSchemeRegex => new string[]
{
@"soundcloud.com\/*"
};
public override Dictionary<string, string> RequestParams => new Dictionary<string, string>();
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");
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Umbraco.Web.Media.EmbedProviders
{
public class Ted : EmbedProviderBase
{
public override string ApiEndpoint => "http://www.ted.com/talks/oembed.xml";
public override string[] UrlSchemeRegex => new string[]
{
@"ted.com\/talks\/*"
};
public override Dictionary<string, string> RequestParams => new Dictionary<string, string>();
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");
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Umbraco.Web.Media.EmbedProviders
{
public class Vimeo : EmbedProviderBase
{
public override string ApiEndpoint => "https://vimeo.com/api/oembed.xml";
public override string[] UrlSchemeRegex => new string[]
{
@"vimeo\.com/"
};
public override Dictionary<string, string> RequestParams => new Dictionary<string, string>();
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");
}
}
}

View File

@@ -222,7 +222,11 @@ namespace Umbraco.Web.Runtime
.Append<Kickstarter>()
.Append<GettyImages>()
.Append<Instagram>()
.Append<Twitter>();
.Append<Twitter>()
.Append<Vimeo>()
.Append<Ted>()
.Append<Soundcloud>();
}
}
}

View File

@@ -148,6 +148,9 @@
<Compile Include="Media\EmbedProviders\EmbedProvidersCollectionBuilder.cs" />
<Compile Include="Media\EmbedProviders\Flickr.cs" />
<Compile Include="Media\EmbedProviders\GettyImages.cs" />
<Compile Include="Media\EmbedProviders\SoundCloud.cs" />
<Compile Include="Media\EmbedProviders\Ted.cs" />
<Compile Include="Media\EmbedProviders\Vimeo.cs" />
<Compile Include="Media\EmbedProviders\Twitter.cs" />
<Compile Include="Media\EmbedProviders\Kickstarter.cs" />
<Compile Include="Media\EmbedProviders\OEmbedResponse.cs" />