本文整理了Java中com.cloudinary.Url.sourceTypes()
方法的一些代码示例,展示了Url.sourceTypes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.sourceTypes()
方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:sourceTypes
暂无
代码示例来源:origin: cloudinary/cloudinary_java
if (this.sourceTypes != null) {
sourceTypes = this.sourceTypes.split(",");
url.sourceTypes(sourceTypes);
代码示例来源:origin: cloudinary/cloudinary_java
@Test
public void testVideoTagWithSourceTypes() {
String expectedUrl = VIDEO_UPLOAD_PATH + "movie";
String expectedTag = "<video poster='%s.jpg'>" + "<source src='%s.ogv' type='video/ogg'>"
+ "<source src='%s.mp4' type='video/mp4'>" + "</video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl);
String actualTag = cloudinary.url().sourceTypes(new String[]{"ogv", "mp4"})
.videoTag("movie.mp4", emptyMap());
assertEquals(expectedTag, actualTag);
}
代码示例来源:origin: cloudinary/cloudinary_java
@Test
public void testVideoTagWithFallback() {
String expectedUrl = VIDEO_UPLOAD_PATH + "movie";
String fallback = "<span id='spanid'>Cannot display video</span>";
String expectedTag = "<video poster='%s.jpg' src='%s.mp4'>%s</video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, fallback);
String actualTag = cloudinary.url().fallbackContent(fallback).sourceTypes(new String[]{"mp4"})
.videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
expectedTag = "<video poster='%s.jpg'>" + "<source src='%s.webm' type='video/webm'>"
+ "<source src='%s.mp4' type='video/mp4'>" + "<source src='%s.ogv' type='video/ogg'>%s" + "</video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl, fallback);
actualTag = cloudinary.url().fallbackContent(fallback).videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
}
代码示例来源:origin: cloudinary/cloudinary_java
String expectedTag = "<video poster='%s' src='%s.mp4'></video>";
expectedTag = String.format(expectedTag, posterUrl, expectedUrl);
String actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"}).poster(posterUrl)
.videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
expectedTag = "<video poster='%s' src='%s.mp4'></video>";
expectedTag = String.format(expectedTag, posterUrl, expectedUrl);
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
.poster(new Transformation().gravity("north"))
.videoTag("movie", emptyMap());
expectedTag = "<video poster='%s' src='%s.mp4'></video>";
expectedTag = String.format(expectedTag, posterUrl, expectedUrl);
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
.poster(cloudinary.url()
.publicId("my_poster")
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
.poster(null)
.videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
.poster(false)
.videoTag("movie", emptyMap());
代码示例来源:origin: cloudinary/cloudinary_java
String expectedTag = "<video height='100' poster='%s.jpg' src='%s.mp4' width='200'></video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl);
String actualTag = cloudinary.url().transformation(transformation).sourceTypes(new String[]{"mp4"})
.videoTag("movie", asMap("html_height", "100", "html_width", "200"));
assertEquals(expectedTag, actualTag);
代码示例来源:origin: cloudinary/cloudinary_java
@Test
public void testVideoTagWithSourceTransformation() {
String expectedUrl = VIDEO_UPLOAD_PATH + "q_50/w_100/movie";
String expectedOgvUrl = VIDEO_UPLOAD_PATH + "q_50/w_100/q_70/movie";
String expectedMp4Url = VIDEO_UPLOAD_PATH + "q_50/w_100/q_30/movie";
String expectedTag = "<video poster='%s.jpg' width='100'>"
+ "<source src='%s.webm' type='video/webm'>"
+ "<source src='%s.mp4' type='video/mp4'>"
+ "<source src='%s.ogv' type='video/ogg'>"
+ "</video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedMp4Url, expectedOgvUrl);
String actualTag = cloudinary.url().transformation(new Transformation().quality(50).chain().width(100))
.sourceTransformationFor("mp4", new Transformation().quality(30))
.sourceTransformationFor("ogv", new Transformation().quality(70))
.videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
expectedTag = "<video poster='%s.jpg' width='100'>" + "<source src='%s.webm' type='video/webm'>"
+ "<source src='%s.mp4' type='video/mp4'>" + "</video>";
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedMp4Url);
actualTag = cloudinary.url().transformation(new Transformation().quality(50).chain().width(100))
.sourceTransformationFor("mp4", new Transformation().quality(30))
.sourceTransformationFor("ogv", new Transformation().quality(70))
.sourceTypes(new String[]{"webm", "mp4"}).videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
}
内容来源于网络,如有侵权,请联系作者删除!