diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 792e570fb4..11c90f45ef 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -31,12 +31,23 @@ class VideoModule(XModule): self.youtube = xmltree.get('youtube') self.position = 0 self.show_captions = xmltree.get('show_captions', 'true') + self.source = self._get_source(xmltree) if instance_state is not None: state = json.loads(instance_state) if 'position' in state: self.position = int(float(state['position'])) + def _get_source(self, xmltree): + # find the first valid source + source = None + for element in xmltree.findall('source'): + src = element.get('src') + if src: + source = src + break + return source + def handle_ajax(self, dispatch, get): ''' Handle ajax calls to this video. @@ -73,6 +84,7 @@ class VideoModule(XModule): 'streams': self.video_list(), 'id': self.location.html_id(), 'position': self.position, + 'source': self.source, 'display_name': self.display_name, # TODO (cpennington): This won't work when we move to data that isn't on the filesystem 'data_dir': self.metadata['data_dir'], @@ -82,6 +94,5 @@ class VideoModule(XModule): class VideoDescriptor(RawDescriptor): module_class = VideoModule - stores_state = True template_dir_name = "video" diff --git a/lms/templates/video.html b/lms/templates/video.html index bd3ec77fbe..47556095cb 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -13,3 +13,8 @@ +% if source: +
Download video here.
+