diff --git a/common/lib/xmodule/xmodule/video_module/video_module.py b/common/lib/xmodule/xmodule/video_module/video_module.py index 1884a1388c9b..eea74231c91c 100644 --- a/common/lib/xmodule/xmodule/video_module/video_module.py +++ b/common/lib/xmodule/xmodule/video_module/video_module.py @@ -63,6 +63,8 @@ from .video_utils import create_youtube_string, format_xml_exception_message, get_poster, rewrite_video_url from .video_xfields import VideoFields +from openedx.core.djangoapps.appsembler.sites import utils as appsembler_site_utils + # The following import/except block for edxval is temporary measure until # edxval is a proper XBlock Runtime Service. # @@ -393,6 +395,10 @@ def get_html(self, view=STUDENT_VIEW): # it anymore; therefore we force-disable it in this case (when controls aren't visible). autoadvance_this_video = self.auto_advance and autoadvance_enabled + scheme = "https" if settings.HTTPS == "on" else "http" + lms_base_url = appsembler_site_utils.get_lms_link_from_course_key(settings.LMS_ROOT_URL, self.course_id) + lms_root_url = "{}://{}".format(scheme, lms_base_url) if "http" not in lms_base_url else lms_base_url + metadata = { 'saveStateEnabled': view != PUBLIC_VIEW, 'saveStateUrl': self.ajax_url + '/save_user_state', @@ -418,7 +424,7 @@ def get_html(self, view=STUDENT_VIEW): 'transcriptLanguages': sorted_languages, 'ytTestTimeout': settings.YOUTUBE['TEST_TIMEOUT'], 'ytApiUrl': settings.YOUTUBE['API'], - 'lmsRootURL': settings.LMS_ROOT_URL, + 'lmsRootURL': lms_root_url, 'ytMetadataEndpoint': ( # In the new runtime, get YouTube metadata via a handler. The handler supports anonymous users and # can work in sandboxed iframes. In the old runtime, the JS will call the LMS's yt_video_metadata