diff --git a/common/lib/xmodule/xmodule/video_module/video_module.py b/common/lib/xmodule/xmodule/video_module/video_module.py
index 25782d5fa0..24c510828d 100644
--- a/common/lib/xmodule/xmodule/video_module/video_module.py
+++ b/common/lib/xmodule/xmodule/video_module/video_module.py
@@ -216,7 +216,7 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# stream.
if self.edx_video_id and edxval_api:
try:
- val_profiles = ["youtube", "desktop_webm", "desktop_mp4"]
+ val_profiles = ["youtube", "desktop_webm", "desktop_mp4", "hls"]
# strip edx_video_id to prevent ValVideoNotFoundError error if unwanted spaces are there. TNL-5769
val_video_urls = edxval_api.get_urls_for_profiles(self.edx_video_id.strip(), val_profiles)
@@ -226,12 +226,13 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# value will map to `None`
# add the non-youtube urls to the list of alternative sources
- # use the last non-None non-youtube url as the link to download the video
+ # use the last non-None non-youtube non-hls url as the link to download the video
for url in [val_video_urls[p] for p in val_profiles if p != "youtube"]:
if url:
if url not in sources:
sources.append(url)
- if self.download_video:
+ # don't include hls urls for download
+ if self.download_video and not url.endswith('.m3u8'):
# function returns None when the url cannot be re-written
rewritten_link = rewrite_video_url(cdn_url, url)
if rewritten_link:
@@ -269,6 +270,10 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
elif self.html5_sources:
download_video_link = self.html5_sources[0]
+ # don't give the option to download HLS video urls
+ if download_video_link and download_video_link.endswith('.m3u8'):
+ download_video_link = None
+
track_url, transcript_language, sorted_languages = self.get_transcripts_for_student(self.get_transcripts_info())
# CDN_VIDEO_URLS is only to be used here and will be deleted
diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py
index c1559f8231..e02bb8fd7f 100644
--- a/lms/djangoapps/courseware/tests/test_video_mongo.py
+++ b/lms/djangoapps/courseware/tests/test_video_mongo.py
@@ -854,6 +854,46 @@ class TestGetHtmlMethod(BaseTestXmodule):
self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context)
)
+ @patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles')
+ def test_get_html_hls(self, get_urls_for_profiles):
+ """
+ Verify that hls profile functionality works as expected.
+
+ * HLS source should be added into list of available sources
+ * HLS source should not be used for download URL If available from edxval
+ """
+ video_xml = ''
+
+ get_urls_for_profiles.return_value = {
+ 'desktop_webm': 'https://webm.com/dw.webm',
+ 'hls': 'https://hls.com/hls.m3u8',
+ 'youtube': 'https://yt.com/?v=v0TFmdO4ZP0',
+ 'desktop_mp4': 'https://mp4.com/dm.mp4'
+ }
+
+ self.initialize_module(data=video_xml)
+ context = self.item_descriptor.render(STUDENT_VIEW).content
+
+ self.assertIn("'download_video_link': 'https://mp4.com/dm.mp4'", context)
+ self.assertIn('"streams": "1.00:https://yt.com/?v=v0TFmdO4ZP0"', context)
+ self.assertIn(
+ '"sources": ["https://webm.com/dw.webm", "https://mp4.com/dm.mp4", "https://hls.com/hls.m3u8"]', context
+ )
+
+ def test_get_html_hls_no_video_id(self):
+ """
+ Verify that `download_video_link` is set to None for HLS videos if no video id
+ """
+ video_xml = """
+
+ """
+
+ self.initialize_module(data=video_xml)
+ context = self.item_descriptor.render(STUDENT_VIEW).content
+ self.assertIn("'download_video_link': None", context)
+
@attr(shard=1)
class TestVideoCDNRewriting(BaseTestXmodule):
diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt
index 7f3b6d291f..9b7c455d6a 100644
--- a/requirements/edx/github.txt
+++ b/requirements/edx/github.txt
@@ -78,7 +78,7 @@ git+https://github.com/edx/lettuce.git@0.2.20.002#egg=lettuce==0.2.20.002
git+https://github.com/edx/edx-ora2.git@1.2.2#egg=ora2==1.2.2
-e git+https://github.com/edx/edx-submissions.git@1.1.5#egg=edx-submissions==1.1.5
git+https://github.com/edx/ease.git@release-2015-07-14#egg=ease==0.1.3
-git+https://github.com/edx/edx-val.git@0.0.12#egg=edxval==0.0.12
+git+https://github.com/edx/edx-val.git@0.0.13#egg=edxval==0.0.13
git+https://github.com/pmitros/RecommenderXBlock.git@v1.1#egg=recommender-xblock==1.1
git+https://github.com/solashirai/crowdsourcehinter.git@518605f0a95190949fe77bd39158450639e2e1dc#egg=crowdsourcehinter-xblock==0.1
-e git+https://github.com/pmitros/RateXBlock.git@367e19c0f6eac8a5f002fd0f1559555f8e74bfff#egg=rate-xblock