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
f7c28f65
Commit
f7c28f65
authored
Apr 20, 2016
by
Chris Rodriguez
Committed by
Clinton Blackburn
May 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AC-385 adding events for closed captions
parent
c2a48214
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
7 deletions
+43
-7
common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js
+22
-2
common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js
+15
-3
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
+6
-2
No files found.
common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js
View file @
f7c28f65
...
...
@@ -135,7 +135,7 @@
});
it
(
'can emit "show_transcript" event'
,
function
()
{
state
.
el
.
trigger
(
'
captions
:show'
);
state
.
el
.
trigger
(
'
transcript
:show'
);
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'show_transcript'
,
{
id
:
'id'
,
code
:
'html5'
,
...
...
@@ -144,7 +144,7 @@
});
it
(
'can emit "hide_transcript" event'
,
function
()
{
state
.
el
.
trigger
(
'
captions
:hide'
);
state
.
el
.
trigger
(
'
transcript
:hide'
);
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'hide_transcript'
,
{
id
:
'id'
,
code
:
'html5'
,
...
...
@@ -152,6 +152,24 @@
});
});
it
(
'can emit "edx.video.closed_captions.shown" event'
,
function
()
{
state
.
el
.
trigger
(
'captions:show'
);
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.video.closed_captions.shown'
,
{
id
:
'id'
,
code
:
'html5'
,
current_time
:
10
});
});
it
(
'can emit "edx.video.closed_captions.hidden" event'
,
function
()
{
state
.
el
.
trigger
(
'captions:hide'
);
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.video.closed_captions.hidden'
,
{
id
:
'id'
,
code
:
'html5'
,
current_time
:
10
});
});
it
(
'can destroy itself'
,
function
()
{
var
plugin
=
state
.
videoEventsPlugin
;
spyOn
(
$
.
fn
,
'off'
).
and
.
callThrough
();
...
...
@@ -167,6 +185,8 @@
'speedchange'
:
plugin
.
onSpeedChange
,
'language_menu:show'
:
plugin
.
onShowLanguageMenu
,
'language_menu:hide'
:
plugin
.
onHideLanguageMenu
,
'transcript:show'
:
plugin
.
onShowTranscript
,
'transcript:hide'
:
plugin
.
onHideTranscript
,
'captions:show'
:
plugin
.
onShowCaptions
,
'captions:hide'
:
plugin
.
onHideCaptions
,
'destroy'
:
plugin
.
destroy
...
...
common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js
View file @
f7c28f65
...
...
@@ -17,7 +17,9 @@ define('video/09_events_plugin.js', [], function() {
_
.
bindAll
(
this
,
'onReady'
,
'onPlay'
,
'onPause'
,
'onEnded'
,
'onSeek'
,
'onSpeedChange'
,
'onShowLanguageMenu'
,
'onHideLanguageMenu'
,
'onSkip'
,
'onShowCaptions'
,
'onHideCaptions'
,
'destroy'
);
'onShowTranscript'
,
'onHideTranscript'
,
'onShowCaptions'
,
'onHideCaptions'
,
'destroy'
);
this
.
state
=
state
;
this
.
options
=
_
.
extend
({},
options
);
this
.
state
.
videoEventsPlugin
=
this
;
...
...
@@ -45,6 +47,8 @@ define('video/09_events_plugin.js', [], function() {
'speedchange'
:
this
.
onSpeedChange
,
'language_menu:show'
:
this
.
onShowLanguageMenu
,
'language_menu:hide'
:
this
.
onHideLanguageMenu
,
'transcript:show'
:
this
.
onShowTranscript
,
'transcript:hide'
:
this
.
onHideTranscript
,
'captions:show'
:
this
.
onShowCaptions
,
'captions:hide'
:
this
.
onHideCaptions
,
'destroy'
:
this
.
destroy
...
...
@@ -108,14 +112,22 @@ define('video/09_events_plugin.js', [], function() {
this
.
log
(
'video_hide_cc_menu'
,
{
language
:
this
.
getCurrentLanguage
()
});
},
onShow
Captions
:
function
()
{
onShow
Transcript
:
function
()
{
this
.
log
(
'show_transcript'
,
{
current_time
:
this
.
getCurrentTime
()});
},
onHide
Captions
:
function
()
{
onHide
Transcript
:
function
()
{
this
.
log
(
'hide_transcript'
,
{
current_time
:
this
.
getCurrentTime
()});
},
onShowCaptions
:
function
()
{
this
.
log
(
'edx.video.closed_captions.shown'
,
{
current_time
:
this
.
getCurrentTime
()});
},
onHideCaptions
:
function
()
{
this
.
log
(
'edx.video.closed_captions.hidden'
,
{
current_time
:
this
.
getCurrentTime
()});
},
getCurrentTime
:
function
()
{
var
player
=
this
.
state
.
videoPlayer
;
return
player
?
player
.
currentTime
:
0
;
...
...
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
View file @
f7c28f65
...
...
@@ -1131,6 +1131,8 @@
this
.
captionDisplayEl
.
text
(
gettext
(
'(Caption will be displayed when you start playing the video.)'
));
}
this
.
state
.
el
.
trigger
(
'captions:show'
);
},
hideClosedCaptions
:
function
()
{
...
...
@@ -1144,6 +1146,8 @@
.
removeClass
(
'is-active'
)
.
find
(
'.control-text'
)
.
text
(
gettext
(
'Turn on closed captioning'
));
this
.
state
.
el
.
trigger
(
'captions:hide'
);
},
updateCaptioningCookie
:
function
(
method
)
{
...
...
@@ -1191,7 +1195,7 @@
state
.
el
.
addClass
(
'closed'
);
text
=
gettext
(
'Turn on transcripts'
);
if
(
trigger_event
)
{
this
.
state
.
el
.
trigger
(
'
captions
:hide'
);
this
.
state
.
el
.
trigger
(
'
transcript
:hide'
);
}
transcriptControlEl
...
...
@@ -1204,7 +1208,7 @@
this
.
scrollCaption
();
text
=
gettext
(
'Turn off transcripts'
);
if
(
trigger_event
)
{
this
.
state
.
el
.
trigger
(
'
captions
:show'
);
this
.
state
.
el
.
trigger
(
'
transcript
:show'
);
}
transcriptControlEl
...
...
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