From ded4bd2dd153c977c4ebc535980e13a0547027d5 Mon Sep 17 00:00:00 2001 From: Omer Habib Date: Tue, 9 Jun 2020 15:15:07 +0500 Subject: [PATCH] Allow video player to play videos on mobile data - LEARNER-7699 - Subtitles priority updated - By Default English subtitles will be visible --- .../java/org/edx/mobile/util/LocaleUtils.java | 6 +++++- .../view/CourseUnitVideoPlayerFragment.java | 18 +----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/util/LocaleUtils.java b/OpenEdXMobile/src/main/java/org/edx/mobile/util/LocaleUtils.java index 8a02a9f3e9..85aaef33d8 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/util/LocaleUtils.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/util/LocaleUtils.java @@ -186,7 +186,11 @@ public static String getTranscriptURL(@NonNull Context context, if (transcript.containsKey(subtitleLanguage)) { transcriptUrl = transcript.get(subtitleLanguage); } else if (transcript.entrySet().size() > 0) { - transcriptUrl = transcript.entrySet().iterator().next().getValue(); + if (transcript.containsKey(Locale.ENGLISH.getLanguage())) { + transcriptUrl = transcript.get(Locale.ENGLISH.getLanguage()); + } else { + transcriptUrl = transcript.entrySet().iterator().next().getValue(); + } } return transcriptUrl; } diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitVideoPlayerFragment.java b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitVideoPlayerFragment.java index ed30a8164c..0be70599ec 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitVideoPlayerFragment.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitVideoPlayerFragment.java @@ -18,7 +18,6 @@ import org.edx.mobile.model.db.DownloadEntry; import org.edx.mobile.player.PlayerFragment; import org.edx.mobile.util.MediaConsentUtils; -import org.edx.mobile.view.dialog.IDialogCallback; import subtitleFile.Caption; import subtitleFile.TimedTextObject; @@ -178,22 +177,7 @@ private void checkVideoStatus(VideoBlockModel unit) { private void checkVideoStatusAndPlay(VideoBlockModel unit) { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if (!checkDownloadEntry(entry)) return; - if (entry.isDownloaded()) { - startOnlinePlay(entry); - } else { - MediaConsentUtils.requestStreamMedia(getActivity(), new IDialogCallback() { - @Override - public void onPositiveClicked() { - startOnlinePlay(entry); - } - - @Override - public void onNegativeClicked() { - ((BaseFragmentActivity) getActivity()). - showInfoMessage(getString(R.string.wifi_off_message)); - } - }); - } + startOnlinePlay(entry); } private void startOnlinePlay(DownloadEntry model) {