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
786c1148
Commit
786c1148
authored
Jan 31, 2013
by
Vasyl Nakvasiuk
Committed by
Valera Rozuvan
Feb 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
<videoalpha> tag now support multi-source
parent
ed00d207
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
common/lib/xmodule/xmodule/video_module.py
+2
-3
common/lib/xmodule/xmodule/videoalpha_module.py
+13
-7
lms/templates/videoalpha.html
+3
-3
No files found.
common/lib/xmodule/xmodule/video_module.py
View file @
786c1148
...
...
@@ -4,6 +4,8 @@ import logging
from
lxml
import
etree
from
pkg_resources
import
resource_string
,
resource_listdir
from
django.http
import
Http404
from
xmodule.x_module
import
XModule
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.modulestore.xml
import
XMLModuleStore
...
...
@@ -13,9 +15,6 @@ from xmodule.contentstore.content import StaticContent
import
datetime
import
time
import
datetime
import
time
log
=
logging
.
getLogger
(
__name__
)
...
...
common/lib/xmodule/xmodule/videoalpha_module.py
View file @
786c1148
...
...
@@ -4,6 +4,8 @@ import logging
from
lxml
import
etree
from
pkg_resources
import
resource_string
,
resource_listdir
from
django.http
import
Http404
from
xmodule.x_module
import
XModule
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.modulestore.mongo
import
MongoModuleStore
...
...
@@ -13,9 +15,6 @@ from xmodule.contentstore.content import StaticContent
import
datetime
import
time
import
datetime
import
time
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -44,6 +43,9 @@ class VideoAlphaModule(XModule):
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
.
wemb_source
=
self
.
_get_source
(
xmltree
,
[
'wemb'
])
self
.
ogv_source
=
self
.
_get_source
(
xmltree
,
[
'ogv'
])
self
.
track
=
self
.
_get_track
(
xmltree
)
self
.
start_time
,
self
.
end_time
=
self
.
_get_timeframe
(
xmltree
)
...
...
@@ -52,15 +54,16 @@ class VideoAlphaModule(XModule):
if
'position'
in
state
:
self
.
position
=
int
(
float
(
state
[
'position'
]))
def
_get_source
(
self
,
xmltree
):
def
_get_source
(
self
,
xmltree
,
extension
=
[
'mp4'
,
'ogv'
,
'avi'
,
'webm'
]
):
# find the first valid source
return
self
.
_get_first_external
(
xmltree
,
'source'
)
condition
=
lambda
src
:
any
([
src
.
endswith
(
ext
)
for
ext
in
extension
])
return
self
.
_get_first_external
(
xmltree
,
'source'
,
condition
)
def
_get_track
(
self
,
xmltree
):
# find the first valid track
return
self
.
_get_first_external
(
xmltree
,
'track'
)
def
_get_first_external
(
self
,
xmltree
,
tag
):
def
_get_first_external
(
self
,
xmltree
,
tag
,
condition
=
bool
):
"""
Will return the first valid element
of the given tag.
...
...
@@ -69,7 +72,7 @@ class VideoAlphaModule(XModule):
result
=
None
for
element
in
xmltree
.
findall
(
tag
):
src
=
element
.
get
(
'src'
)
if
src
:
if
condition
(
src
)
:
result
=
src
break
return
result
...
...
@@ -134,6 +137,9 @@ class VideoAlphaModule(XModule):
'streams'
:
self
.
videoalpha_list
(),
'id'
:
self
.
location
.
html_id
(),
'position'
:
self
.
position
,
'mp4_source'
:
self
.
mp4_source
,
'wemb_source'
:
self
.
wemb_source
,
'ogv_source'
:
self
.
ogv_source
,
'source'
:
self
.
source
,
'track'
:
self
.
track
,
'display_name'
:
self
.
display_name
,
...
...
lms/templates/videoalpha.html
View file @
786c1148
...
...
@@ -11,9 +11,9 @@
id=
"video_${id}"
class=
"video"
data-streams=
""
data-mp4-source=
"http://clips.vorwaerts-gmbh.de/VfE_html5.mp4"
data-webm-source=
"http://clips.vorwaerts-gmbh.de/VfE_html5.webm"
data-ogg-source=
"http://clips.vorwaerts-gmbh.de/VfE_html5.ogv"
${'
data-mp4-source=
"{}"
'.
format
(
mp4_source
)
if
mp4_source
else
''}
${'
data-wemb-source=
"{}"
'.
format
(
wemb_source
)
if
wemb_source
else
''}
${'
data-ogg-source=
"{}"
'.
format
(
ogv_source
)
if
ogv_source
else
''}
data-caption-data-dir=
"${data_dir}"
data-show-captions=
"${show_captions}"
data-start=
"${start}"
...
...
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