diff --git a/common/lib/xmodule/xmodule/js/src/video/display.coffee b/common/lib/xmodule/xmodule/js/src/video/display.coffee
index 3880091661..6587f05899 100644
--- a/common/lib/xmodule/xmodule/js/src/video/display.coffee
+++ b/common/lib/xmodule/xmodule/js/src/video/display.coffee
@@ -11,6 +11,8 @@ class @Video
@parseSpeed()
$("#video_#{@id}").data('video', this).addClass('video-load-complete')
+ @hide_captions = $.cookie('hide_captions') == 'true'
+
if YT.Player
@embed()
else
diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee
index f65debb1a2..b1e41afc3c 100644
--- a/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee
+++ b/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee
@@ -1,6 +1,6 @@
class @VideoCaption extends Subview
initialize: ->
- @loaded = false
+ @loaded = false
bind: ->
$(window).bind('resize', @resize)
@@ -49,7 +49,7 @@ class @VideoCaption extends Subview
@$('.subtitles').html(container.html())
@$('.subtitles li[data-index]').click @seekPlayer
- # prepend and append an empty
for cosmatic reason
+ # prepend and append an empty for cosmetic reason
@$('.subtitles').prepend($('').height(@topSpacingHeight()))
.append($('').height(@bottomSpacingHeight()))
@@ -130,14 +130,21 @@ class @VideoCaption extends Subview
toggle: (event) =>
event.preventDefault()
- if @el.hasClass('closed')
+ if @el.hasClass('closed') # Captions are "closed" e.g. turned off
+ @hideCaptions(false)
+ else # Captions are on
+ @hideCaptions(true)
+
+ hideCaptions: (hide_captions) =>
+ if hide_captions
+ @$('.hide-subtitles').attr('title', 'Turn on captions')
+ @el.addClass('closed')
+ else
@$('.hide-subtitles').attr('title', 'Turn off captions')
@el.removeClass('closed')
@scrollCaption()
- else
- @$('.hide-subtitles').attr('title', 'Turn on captions')
- @el.addClass('closed')
-
+ $.cookie('hide_captions', hide_captions, expires: 3650, path: '/')
+
captionHeight: ->
if @el.hasClass('fullscreen')
$(window).height() - @$('.video-controls').height()
diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee
index 4b265d20c8..bb89def63d 100644
--- a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee
+++ b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee
@@ -45,6 +45,7 @@ class @VideoPlayer extends Subview
events:
onReady: @onReady
onStateChange: @onStateChange
+ @caption.hideCaptions(@['video'].hide_captions)
addToolTip: ->
@$('.add-fullscreen, .hide-subtitles').qtip