For my video assets, I want to set my own thumbnails by adding a new rendition on assets. I am able to retrieve all the renditions uploaded using the getRenditions method however, I want to retrieve the path for the latest uploaded rendition only.
My suggestion is to iterate Asset's Renditions and find the latest one, looking at "jcr:lastModified" property, here is untested code sample:
Rendition lastRendition = null;
Date lastDate = null;
for (Rendition r : asset.getRenditions()) {
Date date = r.getProperties().get(JcrConstants.JCR_LASTMODIFIED);
if (lastDate == null || date.after(lastDate)) {
lastRendition = r;
lastDate = date;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.