Skip to content

Commit 2f13019

Browse files
author
Amir Tocker
committed
Add fps transformation parameter.
1 parent f36b434 commit 2f13019

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

cloudinary-core/src/main/java/com/cloudinary/Cloudinary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class Cloudinary {
4040
public final static String AKAMAI_SHARED_CDN = "res.cloudinary.com";
4141
public final static String SHARED_CDN = AKAMAI_SHARED_CDN;
4242

43-
public final static String VERSION = "1.10.0";
43+
public final static String VERSION = "1.11.0";
4444
public final static String USER_AGENT = "CloudinaryJava/" + VERSION;
4545

4646
public final Configuration config;

cloudinary-core/src/main/java/com/cloudinary/Transformation.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,33 @@ public Transformation endIf() {
413413
return chain();
414414
}
415415

416+
/**
417+
* fps (frames per second) parameter for video
418+
* @param value Either a single value int or float or a range in the format <code>&lt;start&gt;[-&lt;end&gt;]</code>. <br>
419+
* For example, <code>23-29.7</code>
420+
* @return the transformation for chaining
421+
*/
422+
public Transformation fps(String value) {
423+
return param("fps", value);
424+
}
425+
426+
/**
427+
* fps (frames per second) parameter for video
428+
* @param value the desired fps
429+
* @return the transformation for chaining
430+
*/
431+
public Transformation fps(double value) {
432+
return param("fps", new Float(value));
433+
}
434+
435+
/**
436+
* fps (frames per second) parameter for video
437+
* @param value the desired fps
438+
* @return the transformation for chaining
439+
*/
440+
public Transformation fps(int value) {
441+
return param("fps", new Integer(value));
442+
}
416443

417444
public boolean isResponsive() {
418445
return this.isResponsive;
@@ -584,6 +611,7 @@ public String generate(Map options) {
584611
"dl", "delay",
585612
"dn", "density",
586613
"f", "fetch_format",
614+
"fps", "fps",
587615
"g", "gravity",
588616
"l", "overlay",
589617
"p", "prefix",

cloudinary-core/src/test/java/com/cloudinary/test/CloudinaryTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,19 @@ public void testResponsiveBreakpointsToJson() {
10601060
assertArrayEquals(expectedArr, actualArr);
10611061
}
10621062

1063+
@Test
1064+
public void testFps() {
1065+
Transformation t = new Transformation().fps(12);
1066+
assertEquals("fps_12", t.generate());
1067+
t = new Transformation().fps(12.5);
1068+
assertEquals("fps_12.5", t.generate());
1069+
t = new Transformation().fps("12");
1070+
assertEquals("fps_12", t.generate());
1071+
t = new Transformation().fps("12-25.6");
1072+
assertEquals("fps_12-25.6", t.generate());
1073+
1074+
}
1075+
10631076
public static Map<String, String> getUrlParameters(URI uri) throws UnsupportedEncodingException {
10641077
Map<String, String> params = new HashMap<String, String>();
10651078
for (String param : uri.getRawQuery().split("&")) {
@@ -1073,4 +1086,6 @@ public static Map<String, String> getUrlParameters(URI uri) throws UnsupportedEn
10731086
}
10741087
return params;
10751088
}
1089+
1090+
10761091
}

0 commit comments

Comments
 (0)