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
5f5a77ac
Commit
5f5a77ac
authored
Mar 16, 2015
by
ataki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comment, refactor, handle edge cases
parent
27d3d034
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
common/lib/xmodule/xmodule/js/src/video/00_sjson.js
+20
-12
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
+1
-1
common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js
+1
-1
No files found.
common/lib/xmodule/xmodule/js/src/video/00_sjson.js
View file @
5f5a77ac
...
...
@@ -62,15 +62,24 @@ function() {
};
function
filter
(
start
,
end
)
{
/* filters captions that occur between inputs
* `start` and `end`. Start and end should
* be Numbers (doubles) corresponding to the
* number of seconds elapsed since the beginning
* of the video.
*
* Returns an object with properties
* "start" and "captions" representing
* parallel arrays of start times and
* their corresponding captions.
*/
var
filteredTimes
=
[];
var
filteredCaptions
=
[];
var
startTimes
=
getStartTimes
();
var
captions
=
getCaptions
();
var
currentStartTime
;
var
i
;
if
(
startTimes
.
length
!==
captions
.
length
)
{
return
[]
;
throw
new
Exception
(
"video caption and start time arrays do not match in length"
)
;
}
// if end is null, then it's been set to
...
...
@@ -80,17 +89,16 @@ function() {
end
=
startTimes
[
startTimes
.
length
-
1
];
}
for
(
i
=
0
;
i
<
startTimes
.
length
;
i
++
)
{
currentStartTime
=
startTimes
[
i
];
if
(
currentStartTime
>=
start
&&
currentStartTime
<=
end
)
{
filteredTimes
.
push
(
currentStartTime
);
filteredCaptions
.
push
(
captions
[
i
]);
}
}
_
.
filter
(
startTimes
,
function
(
currentStartTime
,
i
)
{
if
(
currentStartTime
>=
start
&&
currentStartTime
<=
end
)
{
filteredTimes
.
push
(
currentStartTime
);
filteredCaptions
.
push
(
captions
[
i
]);
}
});
return
{
'start'
:
filteredTimes
,
'captions'
:
filteredCaptions
'start'
:
filteredTimes
,
'captions'
:
filteredCaptions
};
}
...
...
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
View file @
5f5a77ac
...
...
@@ -818,7 +818,7 @@ function (HTML5Video, Resizer) {
endTime
=
this
.
videoPlayer
.
duration
(),
youTubeId
;
if
(
this
.
config
.
endTime
!==
null
)
{
if
(
this
.
config
.
endTime
)
{
endTime
=
Math
.
min
(
this
.
config
.
endTime
,
endTime
);
}
...
...
common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js
View file @
5f5a77ac
...
...
@@ -166,7 +166,7 @@ function () {
var
time
=
ui
.
value
,
endTime
=
this
.
videoPlayer
.
duration
();
if
(
this
.
config
.
endTime
!==
null
)
{
if
(
this
.
config
.
endTime
)
{
endTime
=
Math
.
min
(
this
.
config
.
endTime
,
endTime
);
}
...
...
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