Skip to content
Snippets Groups Projects
Commit c6fbae57 authored by gnaegi's avatar gnaegi
Browse files

OO-725 make default preferred resolution configurable, set preloading to false

parent c35b5a42
No related branches found
No related tags found
No related merge requests found
...@@ -66,8 +66,11 @@ public class VideoModule extends AbstractSpringModule { ...@@ -66,8 +66,11 @@ public class VideoModule extends AbstractSpringModule {
private String transcodingTasksetConfig; private String transcodingTasksetConfig;
@Value("${video.transcoding.dir}") @Value("${video.transcoding.dir}")
private String transcodingDir; private String transcodingDir;
@Value("${video.transcoding.resolution.preferred}")
private String transcodingPreferredResolutionConf;
private int[] transcodingResolutionsArr = new int[] { 1080,720,480,360 }; private int[] transcodingResolutionsArr = new int[] { 1080,720,480,360 };
private Integer preferredDefaultResolution = new Integer(720);
@Autowired @Autowired
...@@ -89,6 +92,13 @@ public class VideoModule extends AbstractSpringModule { ...@@ -89,6 +92,13 @@ public class VideoModule extends AbstractSpringModule {
log.error("Cannot parse transcoding resolutions", e); log.error("Cannot parse transcoding resolutions", e);
} }
} }
if(StringHelper.containsNonWhitespace(transcodingPreferredResolutionConf)) {
try {
preferredDefaultResolution = Integer.valueOf(transcodingPreferredResolutionConf);
} catch (NumberFormatException e) {
log.error("Cannot parse property video.transcoding.resolution.preferred::" + transcodingPreferredResolutionConf, e);
}
}
super.initDefaultProperties(); super.initDefaultProperties();
} }
...@@ -133,6 +143,15 @@ public class VideoModule extends AbstractSpringModule { ...@@ -133,6 +143,15 @@ public class VideoModule extends AbstractSpringModule {
return transcodingResolutionsArr; return transcodingResolutionsArr;
//TODO: implement GUI for reading/Setting //TODO: implement GUI for reading/Setting
} }
/**
* Use this resolution if the user has no own preferred resolution
* @return
*/
public Integer getPreferredDefaultResolution() {
return preferredDefaultResolution;
//TODO: implement GUI for reading/Setting
}
/** /**
* The base container where the transcoded videos are stored. This config can only be set in * The base container where the transcoded videos are stored. This config can only be set in
......
...@@ -41,6 +41,7 @@ import org.olat.core.util.vfs.VFSContainer; ...@@ -41,6 +41,7 @@ import org.olat.core.util.vfs.VFSContainer;
import org.olat.core.util.vfs.VFSLeaf; import org.olat.core.util.vfs.VFSLeaf;
import org.olat.modules.video.VideoManager; import org.olat.modules.video.VideoManager;
import org.olat.modules.video.VideoMetadata; import org.olat.modules.video.VideoMetadata;
import org.olat.modules.video.VideoModule;
import org.olat.modules.video.VideoTranscoding; import org.olat.modules.video.VideoTranscoding;
import org.olat.modules.video.manager.VideoMediaMapper; import org.olat.modules.video.manager.VideoMediaMapper;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
...@@ -56,6 +57,8 @@ public class VideoDisplayController extends BasicController { ...@@ -56,6 +57,8 @@ public class VideoDisplayController extends BasicController {
private static final String GUIPREF_KEY_PREFERRED_RESOLUTION = "preferredResolution"; private static final String GUIPREF_KEY_PREFERRED_RESOLUTION = "preferredResolution";
@Autowired @Autowired
private VideoModule videoModule;
@Autowired
private VideoManager videoManager; private VideoManager videoManager;
private UserCommentsAndRatingsController commentsAndRatingCtr; private UserCommentsAndRatingsController commentsAndRatingCtr;
...@@ -110,8 +113,7 @@ public class VideoDisplayController extends BasicController { ...@@ -110,8 +113,7 @@ public class VideoDisplayController extends BasicController {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences(); Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
userPreferredResolution = (Integer) guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION); userPreferredResolution = (Integer) guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION);
if (userPreferredResolution == null) { if (userPreferredResolution == null) {
// default value if not yet stored: 720p videos userPreferredResolution = videoModule.getPreferredDefaultResolution();
userPreferredResolution = new Integer(720);
} }
mainVC.contextPut("autoplay", autoplay); mainVC.contextPut("autoplay", autoplay);
......
<div class="o_video_run o_block_large_bottom o_clearfix"> <div class="o_video_run o_block_large_bottom o_clearfix">
<div class="olatFlashMovieViewer"> <div class="olatFlashMovieViewer">
<video id="$r.getId("o_vid")" width="$width" height="$height" poster="$masterUrl/poster.jpg" controls #if( $autoplay ) autoplay #end class="o_video"> <video id="$r.getId("o_vid")" width="$width" height="$height" poster="$masterUrl/poster.jpg" controls preload="none" #if( $autoplay ) autoplay #end class="o_video">
#foreach($video in $videos) #foreach($video in $videos)
#set($position = $velocityCount - 1) #set($position = $velocityCount - 1)
<source type="video/mp4" src="$transcodedUrl/${video.getResolution()}video.mp4" title="$displayTitles.get($position) ($r.formatBytes(${video.getSize()}))" /> <source type="video/mp4" src="$transcodedUrl/${video.getResolution()}video.mp4" title="$displayTitles.get($position) ($r.formatBytes(${video.getSize()}))" />
......
...@@ -1185,6 +1185,9 @@ video.transcoding.taskset.cpuconfig.values=0,1 to indicate usage of 2 cores, set ...@@ -1185,6 +1185,9 @@ video.transcoding.taskset.cpuconfig.values=0,1 to indicate usage of 2 cores, set
# List of transcoding versions to be generated by the transcoder # List of transcoding versions to be generated by the transcoder
video.transcoding.resolutions=1080,720,480,360 video.transcoding.resolutions=1080,720,480,360
video.transcoding.resolutions.values=2160,1080,720,480,360,240 video.transcoding.resolutions.values=2160,1080,720,480,360,240
# The preferred resolution if multiple video versions are available and the user has no
# customized setting. Should be a values from video.transcoding.resolutions
video.transcoding.resolution.preferred=720
# Where to store transcoded versions. This can be located on another path in case the # Where to store transcoded versions. This can be located on another path in case the
# transcoding service is working on another physical server or you just want it to use # transcoding service is working on another physical server or you just want it to use
# another (cheap) disk. By default it is also located in the olatdata dir. # another (cheap) disk. By default it is also located in the olatdata dir.
......
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