Search in sources :

Example 1 with TranscriptModel

use of org.edx.mobile.model.api.TranscriptModel in project edx-app-android by edx.

the class CourseAPI method getTranscriptsOfVideo.

@Nullable
public TranscriptModel getTranscriptsOfVideo(@NonNull final String enrollmentId, @NonNull final String videoId) throws Exception {
    TranscriptModel transcript;
    VideoResponseModel vidModel = getVideoById(enrollmentId, videoId);
    if (vidModel != null) {
        if (vidModel.getSummary() != null) {
            transcript = vidModel.getSummary().getTranscripts();
            return transcript;
        }
    }
    return null;
}
Also used : TranscriptModel(org.edx.mobile.model.api.TranscriptModel) VideoResponseModel(org.edx.mobile.model.api.VideoResponseModel) Nullable(android.support.annotation.Nullable)

Example 2 with TranscriptModel

use of org.edx.mobile.model.api.TranscriptModel in project edx-app-android by edx.

the class CourseUnitVideoFragment method playVideoModel.

public synchronized void playVideoModel(final DownloadEntry video) {
    try {
        if (playerFragment.isPlaying()) {
            if (video.getVideoId().equals(playerFragment.getPlayingVideo().getVideoId())) {
                logger.debug("this video is already being played, skipping play event");
                return;
            }
        }
    } catch (Exception ex) {
        logger.debug(ex.toString());
    }
    try {
        // reload this model
        environment.getStorage().reloadDownloadEntry(video);
        logger.debug("Resumed= " + playerFragment.isResumed());
        if (!playerFragment.isResumed()) {
            // playback can work only if fragment is resume
            if (playPending != null) {
                playHandler.removeCallbacks(playPending);
            }
            playPending = new Runnable() {

                public void run() {
                    playVideoModel(video);
                }
            };
            playHandler.postDelayed(playPending, 200);
            return;
        } else {
            if (playPending != null) {
                playHandler.removeCallbacks(playPending);
            }
        }
        TranscriptModel transcript = getTranscriptModel(video);
        String filepath = getVideoPath(video);
        playerFragment.prepare(filepath, video.lastPlayedOffset, video.getTitle(), transcript, video);
        try {
            // capture chapter name
            if (chapterName == null) {
                // capture the chapter name of this video
                chapterName = video.chapter;
            }
            videoModel = video;
        } catch (Exception e) {
            logger.error(e);
        }
    } catch (Exception ex) {
        logger.error(ex);
    }
}
Also used : TranscriptModel(org.edx.mobile.model.api.TranscriptModel)

Aggregations

TranscriptModel (org.edx.mobile.model.api.TranscriptModel)2 Nullable (android.support.annotation.Nullable)1 VideoResponseModel (org.edx.mobile.model.api.VideoResponseModel)1