com.cloudinary.Url.videoTag()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中com.cloudinary.Url.videoTag()方法的一些代码示例,展示了Url.videoTag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.videoTag()方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:videoTag

Url.videoTag介绍

暂无

代码示例

代码示例来源:origin: cloudinary/cloudinary_java

public String videoTag(Map<String, String> attributes) {
  return videoTag("", attributes);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public String videoTag(Map<String, String> attributes) {
  return videoTag("", attributes);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public String videoTag() {
  return videoTag("", new HashMap<String, String>());
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public String videoTag(String source) {
  return videoTag(source, new HashMap<String, String>());
}

代码示例来源:origin: cloudinary/cloudinary_java

public String videoTag() {
  return videoTag("", new HashMap<String, String>());
}

代码示例来源:origin: cloudinary/cloudinary_java

public String videoTag(String source) {
  return videoTag(source, new HashMap<String, String>());
}

代码示例来源:origin: cloudinary/cloudinary_java

if (preload != null) attributes.put("preload", preload.toString());
out.println(url.videoTag(attributes));

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testVideoTag() {
  String expectedUrl = VIDEO_UPLOAD_PATH + "movie";
  String 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'>"
      + "</video>";
  expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl);
  assertEquals(expectedTag, cloudinary.url().videoTag("movie", emptyMap()));
  assertEquals(expectedTag, cloudinary.url().publicId("movie").videoTag());
  assertEquals(expectedTag, cloudinary.url().videoTag("movie"));
}

代码示例来源: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 testVideoTagWithAttributes() {
  Map attributes = asMap(
      "autoplay", true,
      "controls", null,
      "loop", null,
      "muted", "true",
      "preload", null,
      "style", "border: 1px");
  String expectedUrl = VIDEO_UPLOAD_PATH + "movie";
  String expectedTag = "<video autoplay='true' controls loop muted='true' poster='%s.jpg' preload style='border: 1px'>"
      + "<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, expectedUrl, expectedUrl);
  assertEquals(expectedTag, cloudinary.url().videoTag("movie", attributes));
}

代码示例来源: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

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);
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl);
actualTag = cloudinary.url().transformation(transformation)
    .videoTag("movie", asMap("html_height", "100", "html_width", "200"));
assertEquals(expectedTag, actualTag);
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl);
actualTag = cloudinary.url().transformation(transformation)
    .videoTag("movie", asMap());
assertEquals(expectedTag, actualTag);
expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl);
actualTag = cloudinary.url().transformation(transformation)
    .videoTag("movie", asMap());
assertEquals(expectedTag, actualTag);

代码示例来源:origin: cloudinary/cloudinary_java

expectedTag = String.format(expectedTag, posterUrl, expectedUrl);
String actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"}).poster(posterUrl)
    .videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
    .poster(new Transformation().gravity("north"))
    .videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
        .format("jpg")
        .transformation(new Transformation().gravity("north")))
    .videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
    .poster(null)
    .videoTag("movie", emptyMap());
assertEquals(expectedTag, actualTag);
    .videoTag("movie", emptyMap());
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);
}

相关文章