@@ -345,6 +345,9 @@ def youtube_deprecated(self):
345345 Return True if youtube is deprecated and hls as primary playback is enabled else False
346346 """
347347 video_config_service = self .runtime .service (self , 'video_config' )
348+ if not video_config_service :
349+ return False
350+
348351 # Return False if `hls` playback feature is disabled.
349352 if not video_config_service .is_hls_playback_enabled (self .location .course_key ):
350353 return False
@@ -362,7 +365,8 @@ def youtube_disabled_for_course(self): # lint-amnesty, pylint: disable=missing-
362365 return cache_response .value
363366
364367 video_config_service = self .runtime .service (self , 'video_config' )
365- youtube_is_disabled = video_config_service .is_youtube_blocked_for_course (self .location .course_key )
368+ youtube_is_disabled = video_config_service .is_youtube_blocked_for_course (
369+ self .location .course_key ) if video_config_service else False
366370 request_cache .set (self .location .context_key , youtube_is_disabled )
367371 return youtube_is_disabled
368372
@@ -452,7 +456,7 @@ def get_html(self, view=STUDENT_VIEW, context=None): # lint-amnesty, pylint: dis
452456 val_profiles = ["youtube" , "desktop_webm" , "desktop_mp4" ]
453457
454458 video_config_service = self .runtime .service (self , 'video_config' )
455- if video_config_service .is_hls_playback_enabled (self .course_id ):
459+ if video_config_service and video_config_service .is_hls_playback_enabled (self .course_id ):
456460 val_profiles .append ('hls' )
457461
458462 # strip edx_video_id to prevent ValVideoNotFoundError error if unwanted spaces are there. TNL-5769
@@ -641,7 +645,7 @@ def get_html(self, view=STUDENT_VIEW, context=None): # lint-amnesty, pylint: dis
641645 }
642646 try :
643647 video_config_service = self .runtime .service (self , 'video_config' )
644- sharing_context = video_config_service .get_public_sharing_context (self , self .course_id )
648+ sharing_context = video_config_service .get_public_sharing_context (self , self .course_id ) if video_config_service else None
645649 if sharing_context :
646650 template_context .update (sharing_context )
647651 except Exception as err :
@@ -658,7 +662,8 @@ def is_transcript_feedback_enabled(self):
658662 try :
659663 # Video transcript feedback must be enabled in order to show the widget
660664 video_config_service = self .runtime .service (self , 'video_config' )
661- feature_enabled = video_config_service .is_transcript_feedback_enabled (self .context_key )
665+ feature_enabled = video_config_service .is_transcript_feedback_enabled (
666+ self .context_key ) if video_config_service else False
662667 except Exception as err : # pylint: disable=broad-except
663668 log .exception (f"Error retrieving course for course ID: { self .context_key } " )
664669 return False
@@ -1111,7 +1116,7 @@ def get_youtube_link(video_id):
11111116
11121117 val_profiles = ['youtube' , 'desktop_webm' , 'desktop_mp4' ]
11131118 video_config_service = self .runtime .service (self , 'video_config' )
1114- if video_config_service .is_hls_playback_enabled (self .scope_ids .usage_id .context_key .for_branch (None )):
1119+ if video_config_service and video_config_service .is_hls_playback_enabled (self .scope_ids .usage_id .context_key .for_branch (None )):
11151120 val_profiles .append ('hls' )
11161121
11171122 # Get video encodings for val profiles.
@@ -1370,7 +1375,7 @@ def student_view_data(self, context=None):
13701375 if self .edx_video_id :
13711376 video_profile_names = context .get ("profiles" , ["mobile_low" , 'desktop_mp4' , 'desktop_webm' , 'mobile_high' ])
13721377 video_config_service = self .runtime .service (self , 'video_config' )
1373- if video_config_service .is_hls_playback_enabled (self .location .course_key ) and 'hls' not in video_profile_names :
1378+ if video_config_service and video_config_service .is_hls_playback_enabled (self .location .course_key ) and 'hls' not in video_profile_names :
13741379 video_profile_names .append ('hls' )
13751380
13761381 # get and cache bulk VAL data for course
0 commit comments