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

@@ -1,9 +0,0 @@
using System.Xml;
namespace Umbraco.Core.Media
{
public interface IEmbedSettingProvider
{
object GetSetting(XmlNode settingNode);
}
}

View File

@@ -647,7 +647,6 @@
<Compile Include="Manifest\PackageManifest.cs" />
<Compile Include="Manifest\DataEditorConverter.cs" />
<Compile Include="Media\IEmbedProvider.cs" />
<Compile Include="Media\IEmbedSettingProvider.cs" />
<Compile Include="Media\OEmbedResult.cs" />
<Compile Include="Media\OEmbedStatus.cs" />
<Compile Include="Migrations\IPostMigration.cs" />

View File

@@ -12,20 +12,6 @@
</requestParams>
</provider>
<!-- Vimeo -->
<provider name="Vimeo" type="Umbraco.Web.Media.EmbedProviders.OEmbedVideo, Umbraco.Web">
<urlShemeRegex><![CDATA[vimeo\.com/]]></urlShemeRegex>
<apiEndpoint><![CDATA[http://vimeo.com/api/oembed.xml]]></apiEndpoint>
<requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, Umbraco.Web"></requestParams>
</provider>
<!-- Ted -->
<provider name="Ted" type="Umbraco.Web.Media.EmbedProviders.OEmbedVideo, Umbraco.Web">
<urlShemeRegex><![CDATA[ted\.com/]]></urlShemeRegex>
<apiEndpoint><![CDATA[http://www.ted.com/talks/oembed.xml]]></apiEndpoint>
<requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, Umbraco.Web"></requestParams>
</provider>
<!-- Issuu Settings -->
<provider name="Issuu" type="Umbraco.Web.Media.EmbedProviders.OEmbedJson, Umbraco.Web">
<urlShemeRegex><![CDATA[issuu.com/(?:.*)/docs]]></urlShemeRegex>
@@ -35,20 +21,6 @@
</requestParams>
</provider>
<!-- SoundCloud Settings -->
<provider name="SoundCloud" type="Umbraco.Web.Media.EmbedProviders.OEmbedRich, Umbraco.Web">
<urlShemeRegex><![CDATA[soundcloud\.com/]]></urlShemeRegex>
<apiEndpoint><![CDATA[http://soundcloud.com/oembed]]></apiEndpoint>
<requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, Umbraco.Web"></requestParams>
</provider>
<!-- StreamDotUmbracoDotCom -->
<provider name="StreamDotUmbracoDotCom" type="Umbraco.Web.Media.EmbedProviders.OEmbedVideo, Umbraco.Web">
<urlShemeRegex><![CDATA[stream\.umbraco\.org/]]></urlShemeRegex>
<apiEndpoint><![CDATA[http://stream.umbraco.org/oembed]]></apiEndpoint>
<requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, Umbraco.Web"></requestParams>
</provider>
<!-- Daily Motion -->
<provider name="DailyMotion" type="Umbraco.Web.Media.EmbedProviders.OEmbedVideo, Umbraco.Web">
<urlShemeRegex><![CDATA[dailymotion\.com/]]></urlShemeRegex>

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" />