'Returns a JSON representation of the student_view of this XModule.
The contract of the JSON content is between the caller and the particular XModule.'

def student_view_data(self, context=None):

    context = (context or {})
    if self.only_on_web:
        return {'only_on_web': True}
    encoded_videos = {}
    val_video_data = {}
    if self.edx_video_id:
        video_profile_names = context.get('profiles', ['mobile_low'])
        val_course_data = self.get_cached_val_data_for_course(video_profile_names, self.location.course_key)
        val_video_data = val_course_data.get(self.edx_video_id, {})
        if val_video_data:
            encoded_videos = val_video_data.get('profiles', {})
        elif (context.get('allow_cache_miss', 'True').lower() == 'true'):
            try:
                val_video_data = edxval_api.get_video_info(self.edx_video_id)
                for enc_vid in val_video_data.pop('encoded_videos'):
                    if (enc_vid['profile'] in video_profile_names):
                        encoded_videos[enc_vid['profile']] = {key: enc_vid[key] for key in ['url', 'file_size']}
            except edxval_api.ValVideoNotFoundError:
                pass
    if (not encoded_videos):
        video_url = (self.html5_sources[0] if self.html5_sources else self.source)
        if video_url:
            encoded_videos['fallback'] = {'url': video_url, 'file_size': 0}
        if self.youtube_id_1_0:
            encoded_videos['youtube'] = {'url': self.create_youtube_url(self.youtube_id_1_0), 'file_size': 0}
    transcripts_info = self.get_transcripts_info()
    transcripts = {lang: self.runtime.handler_url(self, 'transcript', 'download', query=('lang=' + lang), thirdparty=True) for lang in self.available_translations(transcripts_info, verify_assets=False)}
    return {'only_on_web': self.only_on_web, 'duration': val_video_data.get('duration', None), 'transcripts': transcripts, 'encoded_videos': encoded_videos}
