Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
edcd64e9
Commit
edcd64e9
authored
Jul 14, 2017
by
muhammad-ammar
Committed by
muzaffaryousaf
Jul 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edx-videoi-id strip fix
LEARNER-1871
parent
a0da9b89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
common/lib/xmodule/xmodule/video_module/video_module.py
+9
-5
lms/djangoapps/courseware/tests/test_video_mongo.py
+13
-0
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
edcd64e9
...
...
@@ -304,16 +304,20 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
if
xblock_settings
and
'YOUTUBE_API_KEY'
in
xblock_settings
:
yt_api_key
=
xblock_settings
[
'YOUTUBE_API_KEY'
]
poster
=
None
if
edxval_api
and
self
.
edx_video_id
:
poster
=
edxval_api
.
get_course_video_image_url
(
course_id
=
self
.
runtime
.
course_id
.
for_branch
(
None
),
edx_video_id
=
self
.
edx_video_id
.
strip
()
)
metadata
=
{
'saveStateUrl'
:
self
.
system
.
ajax_url
+
'/save_user_state'
,
'autoplay'
:
settings
.
FEATURES
.
get
(
'AUTOPLAY_VIDEOS'
,
False
),
'streams'
:
self
.
youtube_streams
,
'sub'
:
self
.
sub
,
'sources'
:
sources
,
'poster'
:
edxval_api
and
edxval_api
.
get_course_video_image_url
(
course_id
=
self
.
runtime
.
course_id
.
for_branch
(
None
),
edx_video_id
=
self
.
edx_video_id
.
strip
()
),
'poster'
:
poster
,
# This won't work when we move to data that
# isn't on the filesystem
'captionDataDir'
:
getattr
(
self
,
'data_dir'
,
None
),
...
...
@@ -508,7 +512,7 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
break
if
metadata_was_changed_by_user
:
self
.
edx_video_id
=
self
.
edx_video_id
.
strip
()
self
.
edx_video_id
=
self
.
edx_video_id
and
self
.
edx_video_id
.
strip
()
# We want to override `youtube_id_1_0` with val youtube profile in the first place when someone adds/edits
# an `edx_video_id` or its underlying YT val profile. Without this, override will only happen when a user
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
edcd64e9
...
...
@@ -934,6 +934,19 @@ class TestGetHtmlMethod(BaseTestXmodule):
self
.
assertIn
(
'"poster": "/media/video-images/poster.png"'
,
context
)
@patch
(
'xmodule.video_module.video_module.edxval_api.get_course_video_image_url'
)
def
test_poster_image_without_edx_video_id
(
self
,
get_course_video_image_url
):
"""
Verify that poster image is set to None and there is no crash when no edx_video_id.
"""
video_xml
=
'<video display_name="Video" download_video="true" edx_video_id="null">[]</video>'
get_course_video_image_url
.
return_value
=
'/media/video-images/poster.png'
self
.
initialize_module
(
data
=
video_xml
)
context
=
self
.
item_descriptor
.
render
(
STUDENT_VIEW
)
.
content
self
.
assertIn
(
"
\'
poster
\'
:
\'
null
\'
"
,
context
)
@attr
(
shard
=
1
)
class
TestVideoCDNRewriting
(
BaseTestXmodule
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment