Search in sources :

Example 1 with VideoInfo

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;
}
Also used : BlockPath(org.edx.mobile.model.course.BlockPath) IBlock(org.edx.mobile.model.course.IBlock) VideoInfo(org.edx.mobile.model.course.VideoInfo) DownloadEntry(org.edx.mobile.model.db.DownloadEntry)

Example 2 with VideoInfo

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;
}
Also used : SummaryModel(org.edx.mobile.model.api.SummaryModel) VideoInfo(org.edx.mobile.model.course.VideoInfo) NonNull(android.support.annotation.NonNull)

Aggregations

VideoInfo (org.edx.mobile.model.course.VideoInfo)2 NonNull (android.support.annotation.NonNull)1 SummaryModel (org.edx.mobile.model.api.SummaryModel)1 BlockPath (org.edx.mobile.model.course.BlockPath)1 IBlock (org.edx.mobile.model.course.IBlock)1 DownloadEntry (org.edx.mobile.model.db.DownloadEntry)1