29
29
from xblock .core import XBlock
30
30
from xblock .fields import ScopeIds
31
31
from xblock .runtime import KvsFieldData
32
+ from xblocks_contrib .video import VideoBlock as _ExtractedVideoBlock
32
33
33
34
from common .djangoapps .xblock_django .constants import ATTR_KEY_REQUEST_COUNTRY_CODE , ATTR_KEY_USER_ID
34
35
from openedx .core .djangoapps .video_config .models import HLSPlaybackEnabledFlag , CourseYoutubeBlockedFlag
47
48
from xmodule .mako_block import MakoTemplateBlockBase
48
49
from xmodule .modulestore .inheritance import InheritanceKeyValueStore , own_metadata
49
50
from xmodule .raw_block import EmptyDataRawMixin
51
+ from xmodule .util .builtin_assets import add_css_to_fragment , add_webpack_js_to_fragment
50
52
from xmodule .validation import StudioValidation , StudioValidationMessage
51
- from xmodule .util .builtin_assets import add_webpack_js_to_fragment , add_css_to_fragment
52
53
from xmodule .video_block import manage_video_subtitles_save
53
54
from xmodule .x_module import (
54
55
PUBLIC_VIEW , STUDENT_VIEW ,
55
56
ResourceTemplates , shim_xmodule_js ,
56
57
XModuleMixin , XModuleToXBlockMixin ,
57
58
)
58
59
from xmodule .xml_block import XmlMixin , deserialize_field , is_pointer_tag , name_to_pathname
59
-
60
60
from .bumper_utils import bumperize
61
61
from .sharing_sites import sharing_sites_info_for_video
62
62
from .transcripts_utils import (
70
70
from .video_handlers import VideoStudentViewHandlers , VideoStudioViewHandlers
71
71
from .video_utils import create_youtube_string , format_xml_exception_message , get_poster , rewrite_video_url
72
72
from .video_xfields import VideoFields
73
+ from ..toggles import USE_EXTRACTED_VIDEO_BLOCK
73
74
74
75
# The following import/except block for edxval is temporary measure until
75
76
# edxval is a proper XBlock Runtime Service.
119
120
120
121
@XBlock .wants ('settings' , 'completion' , 'i18n' , 'request_cache' )
121
122
@XBlock .needs ('mako' , 'user' )
122
- class VideoBlock (
123
+ class _BuiltInVideoBlock (
123
124
VideoFields , VideoTranscriptsMixin , VideoStudioViewHandlers , VideoStudentViewHandlers ,
124
125
EmptyDataRawMixin , XmlMixin , EditingMixin , XModuleToXBlockMixin ,
125
126
ResourceTemplates , XModuleMixin , LicenseMixin ):
@@ -134,6 +135,7 @@ class VideoBlock(
134
135
<source src=".../mit-3091x/M-3091X-FA12-L21-3_100.ogv"/>
135
136
</video>
136
137
"""
138
+ is_extracted = False
137
139
has_custom_completion = True
138
140
completion_mode = XBlockCompletionMode .COMPLETABLE
139
141
@@ -1260,3 +1262,9 @@ def _poster(self):
1260
1262
edx_video_id = self .edx_video_id .strip ()
1261
1263
)
1262
1264
return None
1265
+
1266
+
1267
+ VideoBlock = (
1268
+ _ExtractedVideoBlock if USE_EXTRACTED_VIDEO_BLOCK .is_enabled ()
1269
+ else _BuiltInVideoBlock
1270
+ )
0 commit comments