diff --git a/xmodule/video_block/video_block.py b/xmodule/video_block/video_block.py index 0df838f90c09..34f0999962c0 100644 --- a/xmodule/video_block/video_block.py +++ b/xmodule/video_block/video_block.py @@ -1214,9 +1214,9 @@ def student_view_data(self, context=None): # Fall back to other video URLs in the video block if not found in VAL if not encoded_videos: if all_sources: - encoded_videos["fallback"] = { + encoded_videos["mobile_high"] = { "url": all_sources[0], - "file_size": 0, # File size is unknown for fallback URLs + "file_size": self.file_size, } # Include youtube link if there is no encoding for mobile- ie only a fallback URL or no encodings at all @@ -1235,7 +1235,7 @@ def student_view_data(self, context=None): return { "only_on_web": self.only_on_web, - "duration": val_video_data.get('duration', None), + "duration": int(val_video_data.get('duration', self.file_length.total_seconds())), "transcripts": transcripts, "encoded_videos": encoded_videos, "all_sources": all_sources, diff --git a/xmodule/video_block/video_xfields.py b/xmodule/video_block/video_xfields.py index 873ed01f285c..907eb4bea4b8 100644 --- a/xmodule/video_block/video_xfields.py +++ b/xmodule/video_block/video_xfields.py @@ -5,7 +5,7 @@ import datetime -from xblock.fields import Boolean, DateTime, Dict, Float, List, Scope, String +from xblock.fields import Boolean, DateTime, Dict, Float, List, Scope, String, Integer from xmodule.fields import RelativeTime @@ -93,6 +93,18 @@ class VideoFields: display_name=_("Video File URLs"), scope=Scope.settings, ) + file_size = Integer( + help=_("Add video size. This size appears in mobile app via file downloading"), + display_name=_("Video File Size"), + scope=Scope.settings, + default=0 + ) + file_length = RelativeTime( + help=_("Add video length. This length appears in mobile app via file downloading. Formatted as HH:MM:SS"), + display_name=_("Video File Length"), + scope=Scope.settings, + default=datetime.timedelta(seconds=0) + ) track = String( help=_("By default, students can download an .srt or .txt transcript when you set Download Transcript " "Allowed to True. If you want to provide a downloadable transcript in a different format, we recommend "