Skip to content

Commit

Permalink
chore: adds video block flag
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan committed Oct 27, 2024
1 parent cb051a9 commit 833b935
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions xmodule/video_block/video_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from xblock.core import XBlock
from xblock.fields import ScopeIds
from xblock.runtime import KvsFieldData
from xblocks_contrib.video import VideoBlock as _ExtractedVideoBlock

from common.djangoapps.xblock_django.constants import ATTR_KEY_REQUEST_COUNTRY_CODE, ATTR_KEY_USER_ID
from openedx.core.djangoapps.video_config.models import HLSPlaybackEnabledFlag, CourseYoutubeBlockedFlag
Expand All @@ -47,16 +48,15 @@
from xmodule.mako_block import MakoTemplateBlockBase
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata
from xmodule.raw_block import EmptyDataRawMixin
from xmodule.util.builtin_assets import add_css_to_fragment, add_webpack_js_to_fragment
from xmodule.validation import StudioValidation, StudioValidationMessage
from xmodule.util.builtin_assets import add_webpack_js_to_fragment, add_css_to_fragment
from xmodule.video_block import manage_video_subtitles_save
from xmodule.x_module import (
PUBLIC_VIEW, STUDENT_VIEW,
ResourceTemplates, shim_xmodule_js,
XModuleMixin, XModuleToXBlockMixin,
)
from xmodule.xml_block import XmlMixin, deserialize_field, is_pointer_tag, name_to_pathname

from .bumper_utils import bumperize
from .sharing_sites import sharing_sites_info_for_video
from .transcripts_utils import (
Expand All @@ -70,6 +70,7 @@
from .video_handlers import VideoStudentViewHandlers, VideoStudioViewHandlers
from .video_utils import create_youtube_string, format_xml_exception_message, get_poster, rewrite_video_url
from .video_xfields import VideoFields
from ..toggles import USE_EXTRACTED_VIDEO_BLOCK

# The following import/except block for edxval is temporary measure until
# edxval is a proper XBlock Runtime Service.
Expand Down Expand Up @@ -119,7 +120,7 @@

@XBlock.wants('settings', 'completion', 'i18n', 'request_cache')
@XBlock.needs('mako', 'user')
class VideoBlock(
class _BuiltInVideoBlock(
VideoFields, VideoTranscriptsMixin, VideoStudioViewHandlers, VideoStudentViewHandlers,
EmptyDataRawMixin, XmlMixin, EditingMixin, XModuleToXBlockMixin,
ResourceTemplates, XModuleMixin, LicenseMixin):
Expand All @@ -134,6 +135,7 @@ class VideoBlock(
<source src=".../mit-3091x/M-3091X-FA12-L21-3_100.ogv"/>
</video>
"""
is_extracted = False
has_custom_completion = True
completion_mode = XBlockCompletionMode.COMPLETABLE

Expand Down Expand Up @@ -1260,3 +1262,9 @@ def _poster(self):
edx_video_id=self.edx_video_id.strip()
)
return None


VideoBlock = (
_ExtractedVideoBlock if USE_EXTRACTED_VIDEO_BLOCK.is_enabled()
else _BuiltInVideoBlock
)

0 comments on commit 833b935

Please sign in to comment.