diff --git a/cms/envs/common.py b/cms/envs/common.py index dc8ceb2209..9a1e362692 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -230,6 +230,9 @@ FEATURES = { # Whether or not the dynamic EnrollmentTrackUserPartition should be registered. 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': False, + + # Fetch `hls` profile from edx-val or not + 'ENABLE_HLS_VIDEO_PROFILE': False, } ENABLE_JASMINE = False diff --git a/common/lib/xmodule/xmodule/video_module/video_module.py b/common/lib/xmodule/xmodule/video_module/video_module.py index 8f1dda08e8..26b8b92fe8 100644 --- a/common/lib/xmodule/xmodule/video_module/video_module.py +++ b/common/lib/xmodule/xmodule/video_module/video_module.py @@ -217,7 +217,10 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers, # stream. if self.edx_video_id and edxval_api: try: - val_profiles = ["youtube", "desktop_webm", "desktop_mp4", "hls"] + val_profiles = ["youtube", "desktop_webm", "desktop_mp4"] + + if settings.FEATURES.get('ENABLE_HLS_VIDEO_PROFILE', False): + val_profiles.append('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) diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 6fcf8a7aff..1d5e857bbe 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -855,6 +855,7 @@ class TestGetHtmlMethod(BaseTestXmodule): self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context) ) + @patch.dict('django.conf.settings.FEATURES', {'ENABLE_HLS_VIDEO_PROFILE': True}) @patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles') def test_get_html_hls(self, get_urls_for_profiles): """ @@ -881,6 +882,7 @@ class TestGetHtmlMethod(BaseTestXmodule): '"sources": ["https://webm.com/dw.webm", "https://mp4.com/dm.mp4", "https://hls.com/hls.m3u8"]', context ) + @patch.dict('django.conf.settings.FEATURES', {'ENABLE_HLS_VIDEO_PROFILE': True}) 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