Skip to content
Snippets Groups Projects
Commit dd30dbae authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_14.2'

parents 83aa1ff4 54b1b5c9
No related branches found
No related tags found
No related merge requests found
...@@ -303,6 +303,8 @@ public class ImageComponent extends AbstractComponent implements Disposable { ...@@ -303,6 +303,8 @@ public class ImageComponent extends AbstractComponent implements Disposable {
} }
protected String getSuffix(String contentType) { protected String getSuffix(String contentType) {
if(!StringHelper.containsNonWhitespace(contentType)) return null;
contentType = contentType.toLowerCase(); contentType = contentType.toLowerCase();
if(contentType.indexOf("jpg") >= 0 || contentType.indexOf("jpeg") >= 0) { if(contentType.indexOf("jpg") >= 0 || contentType.indexOf("jpeg") >= 0) {
return "jpg"; return "jpg";
......
...@@ -51,6 +51,8 @@ import org.springframework.stereotype.Service; ...@@ -51,6 +51,8 @@ import org.springframework.stereotype.Service;
public class VideoModule extends AbstractSpringModule { public class VideoModule extends AbstractSpringModule {
private static final Logger log = Tracing.createLoggerFor(VideoModule.class); private static final Logger log = Tracing.createLoggerFor(VideoModule.class);
public static final Integer DEFAULT_RESOLUTION = Integer.valueOf(720);
private static final String VIDEO_ENABLED = "video.enabled"; private static final String VIDEO_ENABLED = "video.enabled";
private static final String VIDEOCOURSENODE_ENABLED = "video.coursenode.enabled"; private static final String VIDEOCOURSENODE_ENABLED = "video.coursenode.enabled";
...@@ -81,8 +83,8 @@ public class VideoModule extends AbstractSpringModule { ...@@ -81,8 +83,8 @@ public class VideoModule extends AbstractSpringModule {
@Value("${video.transcoding.profile}") @Value("${video.transcoding.profile}")
private String transcodingProfile; private String transcodingProfile;
private int[] transcodingResolutionsArr; //= new int[] { 1080,720,480,360 }; private int[] transcodingResolutionsArr; // 1080, 720, 480, 360
private Integer preferredDefaultResolution;// = new Integer(720); private Integer preferredDefaultResolution;// 720
@Autowired @Autowired
private VideoHandler videoHandler; private VideoHandler videoHandler;
...@@ -149,14 +151,14 @@ public class VideoModule extends AbstractSpringModule { ...@@ -149,14 +151,14 @@ public class VideoModule extends AbstractSpringModule {
setVideoTranscodingProfile(this.transcodingProfile); setVideoTranscodingProfile(this.transcodingProfile);
log.info("video.enabled=" + isEnabled()); log.info("video.enabled={}", isEnabled());
log.info("video.coursenode.enabled=" + isCoursenodeEnabled()); log.info("video.coursenode.enabled={}", isCoursenodeEnabled());
log.info("video.transcoding.enabled=" + isTranscodingEnabled()); log.info("video.transcoding.enabled={}", isTranscodingEnabled());
log.info("video.transcoding.resolutions=" + Arrays.toString(getTranscodingResolutions())); log.info("video.transcoding.resolutions={}", Arrays.toString(getTranscodingResolutions()));
log.info("video.transcoding.resolution.preferred=" + getPreferredDefaultResolution()); log.info("video.transcoding.resolution.preferred={}", getPreferredDefaultResolution());
log.info("video.transcoding.taskset.cpuconfig=" + getTranscodingTasksetConfig()); log.info("video.transcoding.taskset.cpuconfig={}", getTranscodingTasksetConfig());
log.info("video.transcoding.local=" + isTranscodingLocal()); log.info("video.transcoding.local={}", isTranscodingLocal());
log.info("video.transcoding.profile=" + getVideoTranscodingProfile()); log.info("video.transcoding.profile={}", getVideoTranscodingProfile());
// Register video site for activation in top navigation // Register video site for activation in top navigation
NewControllerFactory.getInstance().addContextEntryControllerCreator(VideoSite.class.getSimpleName(), NewControllerFactory.getInstance().addContextEntryControllerCreator(VideoSite.class.getSimpleName(),
...@@ -233,7 +235,7 @@ public class VideoModule extends AbstractSpringModule { ...@@ -233,7 +235,7 @@ public class VideoModule extends AbstractSpringModule {
} }
} }
if (transcodingEnabled) { if (transcodingEnabled) {
log.error("Error, no valid transcoding dir. Disabling transcoding. video.transcoding.dir=" + transcodingDir); log.error("Error, no valid transcoding dir. Disabling transcoding. video.transcoding.dir={}", transcodingDir);
// only disable variable, don't store it in persisted properties // only disable variable, don't store it in persisted properties
transcodingEnabled = false; transcodingEnabled = false;
} }
...@@ -306,7 +308,7 @@ public class VideoModule extends AbstractSpringModule { ...@@ -306,7 +308,7 @@ public class VideoModule extends AbstractSpringModule {
return; return;
} }
} }
this.transcodingProfile = "Fast"; // default; this.transcodingProfile = "Fast"; // default
} }
public String getVideoTranscodingProfile() { public String getVideoTranscodingProfile() {
......
...@@ -177,10 +177,7 @@ public class VideoDisplayController extends BasicController { ...@@ -177,10 +177,7 @@ public class VideoDisplayController extends BasicController {
// Load users preferred version from GUI prefs // Load users preferred version from GUI prefs
UserSession usess = ureq.getUserSession(); UserSession usess = ureq.getUserSession();
Preferences guiPrefs = usess.getGuiPreferences(); Preferences guiPrefs = usess.getGuiPreferences();
userPreferredResolution = (Integer) guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION); setUserPreferredResolution((Integer)guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION));
if (userPreferredResolution == null) {
userPreferredResolution = videoModule.getPreferredDefaultResolution();
}
mainVC.contextPut("autoplay", displayOptions.isAutoplay()); mainVC.contextPut("autoplay", displayOptions.isAutoplay());
...@@ -246,6 +243,20 @@ public class VideoDisplayController extends BasicController { ...@@ -246,6 +243,20 @@ public class VideoDisplayController extends BasicController {
mainVC.contextPut("listenTimeUpdate", enable); mainVC.contextPut("listenTimeUpdate", enable);
} }
public Integer getUserPreferredResolution() {
if (userPreferredResolution == null) {
userPreferredResolution = videoModule.getPreferredDefaultResolution();
}
if (userPreferredResolution == null) {
userPreferredResolution = VideoModule.DEFAULT_RESOLUTION;
}
return userPreferredResolution;
}
public void setUserPreferredResolution(Integer resolution) {
userPreferredResolution = resolution;
}
private void initMediaElementJs() { private void initMediaElementJs() {
// load mediaelementjs player, speed and sourcechooser plugins // load mediaelementjs player, speed and sourcechooser plugins
List<String> cssPath = new ArrayList<>(); List<String> cssPath = new ArrayList<>();
...@@ -355,7 +366,7 @@ public class VideoDisplayController extends BasicController { ...@@ -355,7 +366,7 @@ public class VideoDisplayController extends BasicController {
// Check if at least one has equal height, else use master as resource // Check if at least one has equal height, else use master as resource
addMaster &= videoTranscoding.getHeight() < masterResolution.getHeight(); addMaster &= videoTranscoding.getHeight() < masterResolution.getHeight();
// Use the users preferred resolution or the next higher resolution // Use the users preferred resolution or the next higher resolution
if (videoTranscoding.getResolution() >= userPreferredResolution.intValue()) { if (videoTranscoding.getResolution() >= getUserPreferredResolution().intValue()) {
preferredAvailableResolution = readyToPlayVideos.size() - 1; preferredAvailableResolution = readyToPlayVideos.size() - 1;
} }
// Calculate title. Standard title for standard resolution, original title if not standard resolution // Calculate title. Standard title for standard resolution, original title if not standard resolution
...@@ -699,6 +710,7 @@ public class VideoDisplayController extends BasicController { ...@@ -699,6 +710,7 @@ public class VideoDisplayController extends BasicController {
} }
} }
} }
public static class VideoMarkerWrapper { public static class VideoMarkerWrapper {
......
...@@ -95,7 +95,7 @@ public class QuestionConfigurationController extends FormBasicController { ...@@ -95,7 +95,7 @@ public class QuestionConfigurationController extends FormBasicController {
beginEl.setExampleKey("time.format", null); beginEl.setExampleKey("time.format", null);
beginEl.setMandatory(true); beginEl.setMandatory(true);
String timeLimit = question.getTimeLimit() >= 0 ? Long.toString(question.getTimeLimit()) : ""; String timeLimit = question.getTimeLimit() > 0 ? Long.toString(question.getTimeLimit()) : "";
timeLimitEl = uifactory.addTextElement("timeLimit", "video.question.timeLimit", 10, timeLimit, formLayout); timeLimitEl = uifactory.addTextElement("timeLimit", "video.question.timeLimit", 10, timeLimit, formLayout);
String[] onValues = new String[] { translate("video.question.allow.skipping"), translate("video.question.allow.retry") }; String[] onValues = new String[] { translate("video.question.allow.skipping"), translate("video.question.allow.retry") };
...@@ -195,7 +195,12 @@ public class QuestionConfigurationController extends FormBasicController { ...@@ -195,7 +195,12 @@ public class QuestionConfigurationController extends FormBasicController {
try { try {
String beginTime = beginEl.getValue(); String beginTime = beginEl.getValue();
question.setBegin(displayDateFormat.parse(beginTime)); question.setBegin(displayDateFormat.parse(beginTime));
question.setTimeLimit(Long.parseLong(timeLimitEl.getValue())); if(StringHelper.containsNonWhitespace(timeLimitEl.getValue())
&& StringHelper.isLong(timeLimitEl.getValue())) {
question.setTimeLimit(Long.parseLong(timeLimitEl.getValue()));
} else {
question.setTimeLimit(-1l);
}
question.setStyle(styleEl.getSelectedKey()); question.setStyle(styleEl.getSelectedKey());
question.setAllowSkipping(skippingEl.isSelected(0)); question.setAllowSkipping(skippingEl.isSelected(0));
question.setAllowNewAttempt(skippingEl.isSelected(1)); question.setAllowNewAttempt(skippingEl.isSelected(1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment