use of org.olat.modules.video.VideoTranscoding in project OpenOLAT by OpenOLAT.
the class VideoTranscodingDAO method updateTranscoding.
/**
* Merge updated video transcoding, persist on DB
*
* @param videoTranscoding
* @return Updated transcoding object
*/
VideoTranscoding updateTranscoding(VideoTranscoding videoTranscoding) {
((VideoTranscodingImpl) videoTranscoding).setLastModified(new Date());
VideoTranscoding trans = dbInstance.getCurrentEntityManager().merge(videoTranscoding);
return trans;
}
use of org.olat.modules.video.VideoTranscoding in project OpenOLAT by OpenOLAT.
the class VideoAdminErrorController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source instanceof FormLink && ((FormLink) source).getCmd().equals("deleteQuality")) {
FormLink link = (FormLink) source;
VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
videoManager.deleteVideoTranscoding(videoTranscoding);
} else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewAuthor")) {
showUserInfo(ureq, baseSecurity.findIdentityByName((String) source.getUserObject()));
} else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("retranscode")) {
FormLink link = (FormLink) source;
VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
videoManager.retranscodeFailedVideoTranscoding(videoTranscoding);
} else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewResource")) {
FormLink link = (FormLink) source;
VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
launch(ureq, videoTranscoding);
}
initTable();
}
use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.
the class VideoTranscodingDAOTest method getVideoTranscodingByKey.
@Test
public void getVideoTranscodingByKey() {
OLATResource resource = JunitTestHelper.createRandomResource();
VideoTranscoding vTranscoding = videoTranscodingDao.createVideoTranscoding(resource, 1080, "mp4");
dbInstance.commitAndCloseSession();
VideoTranscoding reloadedTranscoding = videoTranscodingDao.getVideoTranscoding(vTranscoding.getKey());
Assert.assertNotNull(reloadedTranscoding);
Assert.assertEquals(vTranscoding, reloadedTranscoding);
}
use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.
the class VideoTranscodingDAOTest method deleteVideoTranscoding.
@Test
public void deleteVideoTranscoding() {
// void deleteVideoTranscoding(VideoTranscoding videoTranscoding) {
OLATResource resource = JunitTestHelper.createRandomResource();
// prepare transcodings
VideoTranscoding vTranscoding1 = videoTranscodingDao.createVideoTranscoding(resource, 1080, "mp4");
videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
videoTranscodingDao.createVideoTranscoding(resource, 720, "mp4");
dbInstance.commitAndCloseSession();
// delete single transcoding
videoTranscodingDao.deleteVideoTranscoding(vTranscoding1);
dbInstance.commitAndCloseSession();
List<VideoTranscoding> results = videoTranscodingDao.getVideoTranscodings(resource);
Assert.assertEquals(3, results.size());
// delete all transcodings of resource
videoTranscodingDao.deleteVideoTranscodings(resource);
dbInstance.commitAndCloseSession();
results = videoTranscodingDao.getVideoTranscodings(resource);
Assert.assertEquals(0, results.size());
}
use of org.olat.modules.video.VideoTranscoding in project openolat by klemens.
the class VideoManagerImpl method getMissingTranscodings.
@Override
public List<Integer> getMissingTranscodings(OLATResource videoResource) {
// get resolutions which are turned on in the videomodule
int[] configuredResolutions = videoModule.getTranscodingResolutions();
// turn the int[]-Array into a List
List<Integer> configResList = IntStream.of(configuredResolutions).boxed().collect(Collectors.toList());
List<VideoTranscoding> videoTranscodings = getVideoTranscodings(videoResource);
for (VideoTranscoding videoTranscoding : videoTranscodings) {
Integer resolution = videoTranscoding.getResolution();
configResList.remove(resolution);
}
return configResList;
}
Aggregations