use of org.edx.mobile.model.course.VideoInfo in project edx-app-android by edx.
the class DatabaseModelFactory method getModel.
/**
* Returns an object of IVideoModel which has all the fields copied from given VideoData.
*
* @param vrm
* @return
*/
public static VideoModel getModel(VideoData vrm, VideoBlockModel block) {
DownloadEntry e = new DownloadEntry();
// FIXME - current database schema is not suitable for arbitary level of course structure tree
// solution - store the navigation path info in into one column field in the database,
// rather than individual column fields.
BlockPath path = block.getPath();
e.chapter = path.get(1) == null ? "" : path.get(1).getDisplayName();
e.section = path.get(2) == null ? "" : path.get(2).getDisplayName();
IBlock root = block.getRoot();
e.eid = root.getCourseId();
e.duration = vrm.duration;
final VideoInfo preferredVideoInfo = vrm.encodedVideos.getPreferredVideoInfo();
e.size = preferredVideoInfo.fileSize;
e.title = block.getDisplayName();
e.url = preferredVideoInfo.url;
e.url_high_quality = getVideoNetworkUrlOrNull(vrm.encodedVideos.mobileHigh);
e.url_low_quality = getVideoNetworkUrlOrNull(vrm.encodedVideos.mobileLow);
e.url_youtube = getVideoNetworkUrlOrNull(vrm.encodedVideos.youtube);
e.videoId = block.getId();
e.transcript = vrm.transcripts;
e.lmsUrl = block.getBlockUrl();
e.isVideoForWebOnly = vrm.onlyOnWeb;
return e;
}
use of org.edx.mobile.model.course.VideoInfo in project edx-app-android by edx.
the class CourseAPI method mappingSummaryModelFrom.
@NonNull
private static SummaryModel mappingSummaryModelFrom(@NonNull final VideoBlockModel videoBlockModel) {
SummaryModel model = new SummaryModel();
model.setType(videoBlockModel.getType());
model.setDisplayName(videoBlockModel.getDisplayName());
model.setDuration((int) videoBlockModel.getData().duration);
model.setOnlyOnWeb(videoBlockModel.getData().onlyOnWeb);
model.setId(videoBlockModel.getId());
final VideoInfo videoInfo = videoBlockModel.getData().encodedVideos.getPreferredVideoInfo();
if (null != videoInfo) {
model.setVideoUrl(videoInfo.url);
model.setSize(videoInfo.fileSize);
}
model.setTranscripts(videoBlockModel.getData().transcripts);
// private EncodingsModel encodings;
return model;
}
Aggregations