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
5ec5e97a
Commit
5ec5e97a
authored
Mar 14, 2017
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backend changes to support hls
TNL-6541
parent
173e5922
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
4 deletions
+49
-4
common/lib/xmodule/xmodule/video_module/video_module.py
+8
-3
lms/djangoapps/courseware/tests/test_video_mongo.py
+40
-0
requirements/edx/github.txt
+1
-1
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
5ec5e97a
...
...
@@ -216,7 +216,7 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# stream.
if
self
.
edx_video_id
and
edxval_api
:
try
:
val_profiles
=
[
"youtube"
,
"desktop_webm"
,
"desktop_mp4"
]
val_profiles
=
[
"youtube"
,
"desktop_webm"
,
"desktop_mp4"
,
"hls"
]
# strip edx_video_id to prevent ValVideoNotFoundError error if unwanted spaces are there. TNL-5769
val_video_urls
=
edxval_api
.
get_urls_for_profiles
(
self
.
edx_video_id
.
strip
(),
val_profiles
)
...
...
@@ -226,12 +226,13 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# value will map to `None`
# 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
# use the last non-None non-youtube
non-hls
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
:
# don't include hls urls for download
if
self
.
download_video
and
not
url
.
endswith
(
'.m3u8'
):
# function returns None when the url cannot be re-written
rewritten_link
=
rewrite_video_url
(
cdn_url
,
url
)
if
rewritten_link
:
...
...
@@ -269,6 +270,10 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
elif
self
.
html5_sources
:
download_video_link
=
self
.
html5_sources
[
0
]
# don't give the option to download HLS video urls
if
download_video_link
and
download_video_link
.
endswith
(
'.m3u8'
):
download_video_link
=
None
track_url
,
transcript_language
,
sorted_languages
=
self
.
get_transcripts_for_student
(
self
.
get_transcripts_info
())
# CDN_VIDEO_URLS is only to be used here and will be deleted
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
5ec5e97a
...
...
@@ -854,6 +854,46 @@ class TestGetHtmlMethod(BaseTestXmodule):
self
.
item_descriptor
.
xmodule_runtime
.
render_template
(
'video.html'
,
expected_context
)
)
@patch
(
'xmodule.video_module.video_module.edxval_api.get_urls_for_profiles'
)
def
test_get_html_hls
(
self
,
get_urls_for_profiles
):
"""
Verify that hls profile functionality works as expected.
* HLS source should be added into list of available sources
* HLS source should not be used for download URL If available from edxval
"""
video_xml
=
'<video display_name="Video" download_video="true" edx_video_id="12345-67890">[]</video>'
get_urls_for_profiles
.
return_value
=
{
'desktop_webm'
:
'https://webm.com/dw.webm'
,
'hls'
:
'https://hls.com/hls.m3u8'
,
'youtube'
:
'https://yt.com/?v=v0TFmdO4ZP0'
,
'desktop_mp4'
:
'https://mp4.com/dm.mp4'
}
self
.
initialize_module
(
data
=
video_xml
)
context
=
self
.
item_descriptor
.
render
(
STUDENT_VIEW
)
.
content
self
.
assertIn
(
"'download_video_link': 'https://mp4.com/dm.mp4'"
,
context
)
self
.
assertIn
(
'"streams": "1.00:https://yt.com/?v=v0TFmdO4ZP0"'
,
context
)
self
.
assertIn
(
'"sources": ["https://webm.com/dw.webm", "https://mp4.com/dm.mp4", "https://hls.com/hls.m3u8"]'
,
context
)
def
test_get_html_hls_no_video_id
(
self
):
"""
Verify that `download_video_link` is set to None for HLS videos if no video id
"""
video_xml
=
"""
<video display_name="Video" download_video="true" source="https://hls.com/hls.m3u8">
["https://hls.com/hls2.m3u8", "https://hls.com/hls3.m3u8"]
</video>
"""
self
.
initialize_module
(
data
=
video_xml
)
context
=
self
.
item_descriptor
.
render
(
STUDENT_VIEW
)
.
content
self
.
assertIn
(
"'download_video_link': None"
,
context
)
@attr
(
shard
=
1
)
class
TestVideoCDNRewriting
(
BaseTestXmodule
):
...
...
requirements/edx/github.txt
View file @
5ec5e97a
...
...
@@ -78,7 +78,7 @@ git+https://github.com/edx/lettuce.git@0.2.20.002#egg=lettuce==0.2.20.002
git+https://github.com/edx/edx-ora2.git@1.2.2#egg=ora2==1.2.2
-e git+https://github.com/edx/edx-submissions.git@1.1.5#egg=edx-submissions==1.1.5
git+https://github.com/edx/ease.git@release-2015-07-14#egg=ease==0.1.3
git+https://github.com/edx/edx-val.git@0.0.1
2#egg=edxval==0.0.12
git+https://github.com/edx/edx-val.git@0.0.1
3#egg=edxval==0.0.13
git+https://github.com/pmitros/RecommenderXBlock.git@v1.1#egg=recommender-xblock==1.1
git+https://github.com/solashirai/crowdsourcehinter.git@518605f0a95190949fe77bd39158450639e2e1dc#egg=crowdsourcehinter-xblock==0.1
-e git+https://github.com/pmitros/RateXBlock.git@367e19c0f6eac8a5f002fd0f1559555f8e74bfff#egg=rate-xblock
...
...
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