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

OO-4548: double check the value of video preferred resolution

parent 344205e2
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,8 @@ import org.springframework.stereotype.Service;
public class VideoModule extends AbstractSpringModule {
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 VIDEOCOURSENODE_ENABLED = "video.coursenode.enabled";
......@@ -81,8 +83,8 @@ public class VideoModule extends AbstractSpringModule {
@Value("${video.transcoding.profile}")
private String transcodingProfile;
private int[] transcodingResolutionsArr; //= new int[] { 1080,720,480,360 };
private Integer preferredDefaultResolution;// = new Integer(720);
private int[] transcodingResolutionsArr; // 1080, 720, 480, 360
private Integer preferredDefaultResolution;// 720
@Autowired
private VideoHandler videoHandler;
......@@ -149,14 +151,14 @@ public class VideoModule extends AbstractSpringModule {
setVideoTranscodingProfile(this.transcodingProfile);
log.info("video.enabled=" + isEnabled());
log.info("video.coursenode.enabled=" + isCoursenodeEnabled());
log.info("video.transcoding.enabled=" + isTranscodingEnabled());
log.info("video.transcoding.resolutions=" + Arrays.toString(getTranscodingResolutions()));
log.info("video.transcoding.resolution.preferred=" + getPreferredDefaultResolution());
log.info("video.transcoding.taskset.cpuconfig=" + getTranscodingTasksetConfig());
log.info("video.transcoding.local=" + isTranscodingLocal());
log.info("video.transcoding.profile=" + getVideoTranscodingProfile());
log.info("video.enabled={}", isEnabled());
log.info("video.coursenode.enabled={}", isCoursenodeEnabled());
log.info("video.transcoding.enabled={}", isTranscodingEnabled());
log.info("video.transcoding.resolutions={}", Arrays.toString(getTranscodingResolutions()));
log.info("video.transcoding.resolution.preferred={}", getPreferredDefaultResolution());
log.info("video.transcoding.taskset.cpuconfig={}", getTranscodingTasksetConfig());
log.info("video.transcoding.local={}", isTranscodingLocal());
log.info("video.transcoding.profile={}", getVideoTranscodingProfile());
// Register video site for activation in top navigation
NewControllerFactory.getInstance().addContextEntryControllerCreator(VideoSite.class.getSimpleName(),
......@@ -233,7 +235,7 @@ public class VideoModule extends AbstractSpringModule {
}
}
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
transcodingEnabled = false;
}
......@@ -306,7 +308,7 @@ public class VideoModule extends AbstractSpringModule {
return;
}
}
this.transcodingProfile = "Fast"; // default;
this.transcodingProfile = "Fast"; // default
}
public String getVideoTranscodingProfile() {
......
......@@ -177,10 +177,7 @@ public class VideoDisplayController extends BasicController {
// Load users preferred version from GUI prefs
UserSession usess = ureq.getUserSession();
Preferences guiPrefs = usess.getGuiPreferences();
userPreferredResolution = (Integer) guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION);
if (userPreferredResolution == null) {
userPreferredResolution = videoModule.getPreferredDefaultResolution();
}
setUserPreferredResolution((Integer)guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION));
mainVC.contextPut("autoplay", displayOptions.isAutoplay());
......@@ -246,6 +243,20 @@ public class VideoDisplayController extends BasicController {
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() {
// load mediaelementjs player, speed and sourcechooser plugins
List<String> cssPath = new ArrayList<>();
......@@ -355,7 +366,7 @@ public class VideoDisplayController extends BasicController {
// Check if at least one has equal height, else use master as resource
addMaster &= videoTranscoding.getHeight() < masterResolution.getHeight();
// Use the users preferred resolution or the next higher resolution
if (videoTranscoding.getResolution() >= userPreferredResolution.intValue()) {
if (videoTranscoding.getResolution() >= getUserPreferredResolution().intValue()) {
preferredAvailableResolution = readyToPlayVideos.size() - 1;
}
// Calculate title. Standard title for standard resolution, original title if not standard resolution
......@@ -699,6 +710,7 @@ public class VideoDisplayController extends BasicController {
}
}
}
public static class VideoMarkerWrapper {
......
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