fix: prefer HTML5 video when youtube support is deprecated.
In the case where a server/course has both: * YouTube deprecated (waffle flag: videos.deprecate_youtube = True) * HLS enabled (ConfigModel: HLSPlaybackEnabledFlag, in video_config) Prior to this commit, we would prefer the HLS source if one of the HTML5 video sources specified a .m3u8 file. However it looks like this file isn't always guaranteed to be produced. This fix always prefers HTML5 video sources to YouTube if the server or course is configured to deprecate YouTube, as long as at least one non-YouTube source is found. TNL-8594. Note that this may confuse users because we're essentially bypassing their Studio-specified preferred primary source with a server-wide setting.
This commit is contained in:
@@ -218,7 +218,7 @@ class VideoBlock(
|
||||
If only either youtube or hls is present then play whichever is present
|
||||
"""
|
||||
yt_present = bool(youtube_streams.strip()) if youtube_streams else False
|
||||
hls_present = any(source for source in html5_sources if source.strip().endswith('.m3u8'))
|
||||
hls_present = any(source for source in html5_sources)
|
||||
|
||||
if yt_present and hls_present:
|
||||
return self.youtube_deprecated
|
||||
|
||||
@@ -1150,7 +1150,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
'waffle_enabled': False,
|
||||
'youtube': '3_yD_cEKoCk',
|
||||
'hls': [],
|
||||
'result': 'false'
|
||||
'result': 'true'
|
||||
},
|
||||
{
|
||||
'course_override': WaffleFlagCourseOverrideModel.ALL_CHOICES.off,
|
||||
|
||||
Reference in New Issue
Block a user