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
5b79352a
Commit
5b79352a
authored
Oct 03, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #806 from MITx/feature/rocha/support-additional-video-sources
Add support for video download link
parents
607fdb02
f357e90d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
common/lib/xmodule/xmodule/video_module.py
+12
-1
lms/templates/video.html
+5
-0
No files found.
common/lib/xmodule/xmodule/video_module.py
View file @
5b79352a
...
...
@@ -31,12 +31,23 @@ class VideoModule(XModule):
self
.
youtube
=
xmltree
.
get
(
'youtube'
)
self
.
position
=
0
self
.
show_captions
=
xmltree
.
get
(
'show_captions'
,
'true'
)
self
.
source
=
self
.
_get_source
(
xmltree
)
if
instance_state
is
not
None
:
state
=
json
.
loads
(
instance_state
)
if
'position'
in
state
:
self
.
position
=
int
(
float
(
state
[
'position'
]))
def
_get_source
(
self
,
xmltree
):
# find the first valid source
source
=
None
for
element
in
xmltree
.
findall
(
'source'
):
src
=
element
.
get
(
'src'
)
if
src
:
source
=
src
break
return
source
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
Handle ajax calls to this video.
...
...
@@ -73,6 +84,7 @@ class VideoModule(XModule):
'streams'
:
self
.
video_list
(),
'id'
:
self
.
location
.
html_id
(),
'position'
:
self
.
position
,
'source'
:
self
.
source
,
'display_name'
:
self
.
display_name
,
# TODO (cpennington): This won't work when we move to data that isn't on the filesystem
'data_dir'
:
self
.
metadata
[
'data_dir'
],
...
...
@@ -82,6 +94,5 @@ class VideoModule(XModule):
class
VideoDescriptor
(
RawDescriptor
):
module_class
=
VideoModule
stores_state
=
True
template_dir_name
=
"video"
lms/templates/video.html
View file @
5b79352a
...
...
@@ -13,3 +13,8 @@
</article>
</div>
</div>
% if source:
<div
class=
"video-sources"
>
<p>
Download video
<a
href=
"${source}"
>
here
</a>
.
</p>
</div>
% endif
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