本文整理汇总了C#中Transformation.Crop方法的典型用法代码示例。如果您正苦于以下问题:C# Transformation.Crop方法的具体用法?C# Transformation.Crop怎么用?C# Transformation.Crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation.Crop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestVideoTagWithTransformation
public void TestVideoTagWithTransformation()
{
var transformation = new Transformation().VideoCodec("codec", "h264").AudioCodec("acc").StartOffset(3);
var expectedUrl = m_defaultVideoUpPath + "ac_acc,so_3.0,vc_h264/movie";
var expectedTag = "<video height='100' poster='{0}.jpg' src='{0}.mp4' width='200'></video>";
expectedTag = String.Format(expectedTag, expectedUrl);
var actualTag = m_api.UrlVideoUp.Transform(transformation).SourceTypes(new string[] { "mp4" })
.BuildVideoTag("movie", "html_height=100", "html_width=200").ToString();
Assert.AreEqual(expectedTag, actualTag);
expectedTag = "<video height='100' poster='{0}.jpg' width='200'>"
+ "<source src='{0}.webm' type='video/webm'>"
+ "<source src='{0}.mp4' type='video/mp4'>"
+ "<source src='{0}.ogv' type='video/ogg'>"
+ "</video>";
expectedTag = String.Format(expectedTag, expectedUrl);
actualTag = m_api.UrlVideoUp.Transform(transformation)
.BuildVideoTag("movie", new StringDictionary() { { "html_height", "100" }, { "html_width", "200" } })
.ToString();
Assert.AreEqual(expectedTag, actualTag);
transformation.Width(250);
expectedUrl = m_defaultVideoUpPath + "ac_acc,so_3.0,vc_h264,w_250/movie";
expectedTag = "<video poster='{0}.jpg' width='250'>"
+ "<source src='{0}.webm' type='video/webm'>"
+ "<source src='{0}.mp4' type='video/mp4'>"
+ "<source src='{0}.ogv' type='video/ogg'>"
+ "</video>";
expectedTag = String.Format(expectedTag, expectedUrl);
actualTag = m_api.UrlVideoUp.Transform(transformation)
.BuildVideoTag("movie").ToString();
Assert.AreEqual(expectedTag, actualTag);
transformation.Crop("fit");
expectedUrl = m_defaultVideoUpPath + "ac_acc,c_fit,so_3.0,vc_h264,w_250/movie";
expectedTag = "<video poster='{0}.jpg'>"
+ "<source src='{0}.webm' type='video/webm'>"
+ "<source src='{0}.mp4' type='video/mp4'>"
+ "<source src='{0}.ogv' type='video/ogg'>"
+ "</video>";
expectedTag = String.Format(expectedTag, expectedUrl);
actualTag = m_api.UrlVideoUp.Transform(transformation)
.BuildVideoTag("movie").ToString();
Assert.AreEqual(expectedTag, actualTag);
}