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
ec552cf1
Commit
ec552cf1
authored
Nov 18, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5981 from edx/mobile/MA-141
MA-141 Support webm encoding for VAL-enabled videos
parents
08cd3272
caf5d539
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
21 deletions
+36
-21
common/lib/xmodule/xmodule/video_module/video_module.py
+14
-8
lms/djangoapps/courseware/tests/test_video_mongo.py
+22
-13
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
ec552cf1
...
...
@@ -184,20 +184,26 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# stream.
if
self
.
edx_video_id
and
edxval_api
:
try
:
val_
video_urls
=
edxval_api
.
get_urls_for_profiles
(
self
.
edx_video_id
,
[
"desktop_mp4"
,
"youtube"
]
)
val_
profiles
=
[
"youtube"
,
"desktop_webm"
,
"desktop_mp4"
]
val_video_urls
=
edxval_api
.
get_urls_for_profiles
(
self
.
edx_video_id
,
val_profiles
)
# VAL will always give us the keys for the profiles we asked for, but
# if it doesn't have an encoded video entry for that Video + Profile, the
# value will map to `None`
if
val_video_urls
[
"desktop_mp4"
]:
# add the non-youtube urls to the list of alternative sources
# use the last non-None non-youtube url as the link to download the video
for
url
in
[
val_video_urls
[
p
]
for
p
in
val_profiles
if
p
!=
"youtube"
]:
if
url
:
if
url
not
in
sources
:
sources
.
append
(
url
)
if
self
.
download_video
:
download_video_link
=
val_video_urls
[
"desktop_mp4"
]
# add the desktop_mp4 profile to the list of alternative sources
if
val_video_urls
[
"desktop_mp4"
]
not
in
sources
:
sources
.
append
(
val_video_urls
[
"desktop_mp4"
])
download_video_link
=
url
# set the youtube url
if
val_video_urls
[
"youtube"
]:
youtube_streams
=
"1.00:{}"
.
format
(
val_video_urls
[
"youtube"
])
except
edxval_api
.
ValInternalError
:
# VAL raises this exception if it can't find data for the edx video ID. This can happen if the
# course data is ported to a machine that does not have the VAL data. So for now, pass on this
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
ec552cf1
...
...
@@ -512,28 +512,33 @@ class TestGetHtmlMethod(BaseTestXmodule):
)
def
test_get_html_with_existing_edx_video_id
(
self
):
# create test profiles and their encodings
encoded_videos
=
[]
for
profile
,
extension
in
[(
"desktop_webm"
,
"webm"
),
(
"desktop_mp4"
,
"mp4"
)]:
result
=
create_profile
(
dict
(
profile_name
=
"desktop_mp4"
,
extension
=
"mp4"
,
profile_name
=
profile
,
extension
=
extension
,
width
=
200
,
height
=
2001
)
)
self
.
assertEqual
(
result
,
"desktop_mp4"
)
self
.
assertEqual
(
result
,
profile
)
encoded_videos
.
append
(
dict
(
url
=
u"http://fake-video.edx.org/thundercats.{}"
.
format
(
extension
),
file_size
=
9000
,
bitrate
=
42
,
profile
=
profile
,
)
)
result
=
create_video
(
dict
(
client_video_id
=
"Thunder Cats"
,
duration
=
111
,
edx_video_id
=
"thundercats"
,
encoded_videos
=
[
dict
(
url
=
u"http://fake-video.edx.org/thundercats.mp4"
,
file_size
=
9000
,
bitrate
=
42
,
profile
=
"desktop_mp4"
,
)
]
encoded_videos
=
encoded_videos
)
)
self
.
assertEqual
(
result
,
"thundercats"
)
...
...
@@ -549,6 +554,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
{sources}
</video>
"""
data
=
{
'download_video'
:
'true'
,
'source'
:
'example_source.mp4'
,
...
...
@@ -559,8 +565,11 @@ class TestGetHtmlMethod(BaseTestXmodule):
'edx_video_id'
:
"thundercats"
,
'result'
:
{
'download_video_link'
:
u'http://fake-video.edx.org/thundercats.mp4'
,
# make sure the desktop_mp4 url is included as part of the alternative sources.
'sources'
:
json
.
dumps
([
u'example.mp4'
,
u'example.webm'
,
u"http://fake-video.edx.org/thundercats.mp4"
]),
# make sure the urls for the various encodings are included as part of the alternative sources.
'sources'
:
json
.
dumps
(
[
u'example.mp4'
,
u'example.webm'
]
+
[
video
[
'url'
]
for
video
in
encoded_videos
]
),
}
}
...
...
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