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
a7b0dd67
Commit
a7b0dd67
authored
Feb 13, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/valera/video_alpha' of github.com:MITx/mitx into feature/valera/video_alpha
parents
6d5e2307
d0ac56ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
31 deletions
+28
-31
common/lib/xmodule/xmodule/videoalpha_module.py
+22
-25
lms/templates/videoalpha.html
+6
-6
No files found.
common/lib/xmodule/xmodule/videoalpha_module.py
View file @
a7b0dd67
...
...
@@ -19,6 +19,18 @@ log = logging.getLogger(__name__)
class
VideoAlphaModule
(
XModule
):
"""
XML source example:
<videoalpha show_captions="true"
youtube="0.75:jNCf2gIqpeE,1.0:ZwkTiUPN0mg,1.25:rsq9auxASqI,1.50:kMyNdzVHHgg"
url_name="lecture_21_3" display_name="S19V3: Vacancies"
>
<source src=".../mit-3091x/M-3091X-FA12-L21-3_100.mp4"/>
<source src=".../mit-3091x/M-3091X-FA12-L21-3_100.webm"/>
<source src=".../mit-3091x/M-3091X-FA12-L21-3_100.ogv"/>
</videoalpha>
"""
video_time
=
0
icon_class
=
'video'
...
...
@@ -39,14 +51,16 @@ class VideoAlphaModule(XModule):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
,
shared_state
,
**
kwargs
)
xmltree
=
etree
.
fromstring
(
self
.
definition
[
'data'
])
self
.
youtube
=
xmltree
.
get
(
'youtube'
)
self
.
youtube
_streams
=
xmltree
.
get
(
'youtube'
)
self
.
sub
=
xmltree
.
get
(
'sub'
)
self
.
position
=
0
self
.
show_captions
=
xmltree
.
get
(
'show_captions'
,
'true'
)
self
.
source
=
self
.
_get_source
(
xmltree
)
self
.
mp4_source
=
self
.
_get_source
(
xmltree
,
[
'mp4'
])
self
.
webm_source
=
self
.
_get_source
(
xmltree
,
[
'webm'
])
self
.
ogv_source
=
self
.
_get_source
(
xmltree
,
[
'ogv'
])
self
.
sources
=
{
'main'
:
self
.
_get_source
(
xmltree
),
'mp4'
:
self
.
_get_source
(
xmltree
,
[
'mp4'
]),
'webm'
:
self
.
_get_source
(
xmltree
,
[
'webm'
]),
'ogv'
:
self
.
_get_source
(
xmltree
,
[
'ogv'
]),
}
self
.
track
=
self
.
_get_track
(
xmltree
)
self
.
start_time
,
self
.
end_time
=
self
.
_get_timeframe
(
xmltree
)
...
...
@@ -109,25 +123,12 @@ class VideoAlphaModule(XModule):
return
json
.
dumps
({
'success'
:
True
})
raise
Http404
()
def
get_progress
(
self
):
''' TODO (vshnayder): Get and save duration of youtube video, then return
fraction watched.
(Be careful to notice when video link changes and update)
For now, we have no way of knowing if the video has even been watched, so
just return None.
'''
return
None
def
get_instance_state
(
self
):
#log.debug(u"STATE POSITION {0}".format(self.position))
return
json
.
dumps
({
'position'
:
self
.
position
})
def
videoalpha_list
(
self
):
return
self
.
youtube
def
get_html
(
self
):
if
isinstance
(
modulestore
(),
MongoModuleStore
)
:
if
isinstance
(
modulestore
(),
MongoModuleStore
):
caption_asset_path
=
StaticContent
.
get_base_url_path_for_course_assets
(
self
.
location
)
+
'/subs_'
else
:
# VS[compat]
...
...
@@ -135,14 +136,10 @@ class VideoAlphaModule(XModule):
caption_asset_path
=
"/static/{0}/subs/"
.
format
(
self
.
metadata
[
'data_dir'
])
return
self
.
system
.
render_template
(
'videoalpha.html'
,
{
'
streams'
:
self
.
videoalpha_list
()
,
'
youtube_streams'
:
self
.
youtube_streams
,
'id'
:
self
.
location
.
html_id
(),
'position'
:
self
.
position
,
'mp4_source'
:
self
.
mp4_source
,
'webm_source'
:
self
.
webm_source
,
'ogv_source'
:
self
.
ogv_source
,
'sub'
:
self
.
sub
,
'source
'
:
self
.
source
,
'source
s'
:
self
.
sources
,
'track'
:
self
.
track
,
'display_name'
:
self
.
display_name
,
# TODO (cpennington): This won't work when we move to data that isn't on the filesystem
...
...
lms/templates/videoalpha.html
View file @
a7b0dd67
...
...
@@ -8,11 +8,11 @@
<div
id=
"video_${id}"
class=
"video"
data-streams=
"${streams}"
data-streams=
"${
youtube_
streams}"
${'
data-sub=
"{}"
'.
format
(
sub
)
if
sub
else
''}
${'
data-mp4-source=
"{}"
'.
format
(
mp4_source
)
if
mp4_source
else
''}
${'
data-webm-source=
"{}"
'.
format
(
webm_source
)
if
webm_source
else
''}
${'
data-ogg-source=
"{}"
'.
format
(
ogv_source
)
if
ogv_source
else
''}
${'
data-mp4-source=
"{}"
'.
format
(
sources
.
get
('
mp4
'))
if
sources
.
get
('
mp4
')
else
''}
${'
data-webm-source=
"{}"
'.
format
(
sources
.
get
('
webm
'))
if
sources
.
get
('
webm
')
else
''}
${'
data-ogg-source=
"{}"
'.
format
(
sources
.
get
('
ogv
'))
if
sources
.
get
('
ogv
')
else
''}
data-caption-data-dir=
"${data_dir}"
data-show-captions=
"${show_captions}"
data-start=
"${start}"
...
...
@@ -30,9 +30,9 @@
</div>
%endif
% if source:
% if source
s.get('main')
:
<div
class=
"video-sources"
>
<p>
Download video
<a
href=
"${source}"
>
here
</a>
.
</p>
<p>
Download video
<a
href=
"${source
.get('main')
}"
>
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