use of org.mycore.media.video.MCRMediaSource in project mycore by MyCoRe-Org.
the class MCRXMLFunctions method getSources.
public static NodeList getSources(String derivateId, String path, String userAgent) throws IOException, ParserConfigurationException, URISyntaxException {
MCRMediaSourceProvider provider = new MCRMediaSourceProvider(derivateId, path, Optional.ofNullable(userAgent), () -> EMPTY_ARRAY);
List<MCRMediaSource> sources = provider.getSources();
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
return new NodeList() {
@Override
public Node item(int index) {
Element source = document.createElement("source");
source.setAttribute("src", sources.get(index).getUri());
source.setAttribute("type", sources.get(index).getType().getMimeType());
return source;
}
@Override
public int getLength() {
return sources.size();
}
};
}
Aggregations