diff --git a/video_xblock/backends/base.py b/video_xblock/backends/base.py index 9873bc2d..0ac1288c 100644 --- a/video_xblock/backends/base.py +++ b/video_xblock/backends/base.py @@ -53,9 +53,6 @@ def get_frag(self, **context): frag.add_javascript(self.render_resource( '../static/js/videojs-speed-handler.js', **context )) - frag.add_javascript(self.resource_string( - '../static/bower_components/videojs-transcript/dist/videojs-transcript.js' - )) frag.add_javascript(self.resource_string( '../static/bower_components/videojs-contextmenu/dist/videojs-contextmenu.min.js' )) @@ -68,15 +65,19 @@ def get_frag(self, **context): frag.add_javascript( self.render_resource('../static/js/player_state.js', **context) ) + if context['player_state']['transcripts']: + frag.add_javascript(self.resource_string( + '../static/bower_components/videojs-transcript/dist/videojs-transcript.js' + )) + frag.add_javascript( + self.render_resource('../static/js/videojs-transcript.js', **context) + ) frag.add_javascript( self.render_resource('../static/js/videojs-tabindex.js', **context) ) frag.add_javascript( self.resource_string('../static/js/toggle-button.js') ) - frag.add_javascript( - self.render_resource('../static/js/videojs-transcript.js', **context) - ) frag.add_javascript(self.render_resource( '../static/js/videojs_event_plugin.js', **context )) diff --git a/video_xblock/backends/brightcove.py b/video_xblock/backends/brightcove.py index 8af69c93..69a52f3d 100644 --- a/video_xblock/backends/brightcove.py +++ b/video_xblock/backends/brightcove.py @@ -32,21 +32,22 @@ def get_frag(self, **context): frag.add_css_url( 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css' ) - frag.add_content( - self.add_js_content('../static/bower_components/videojs-transcript/dist/videojs-transcript.js') - ) frag.add_content( self.add_js_content('../static/js/player_state.js', **context) ) + if context['player_state']['transcripts']: + frag.add_content( + self.add_js_content('../static/bower_components/videojs-transcript/dist/videojs-transcript.js') + ) + frag.add_content( + self.add_js_content('../static/js/videojs-transcript.js', **context) + ) frag.add_content( self.add_js_content('../static/js/videojs-tabindex.js', **context) ) frag.add_content( self.add_js_content('../static/js/toggle-button.js') ) - frag.add_content( - self.add_js_content('../static/js/videojs-transcript.js', **context) - ) frag.add_content( self.add_js_content('../static/js/videojs_event_plugin.js', **context) ) diff --git a/video_xblock/static/css/transcripts.css b/video_xblock/static/css/transcripts.css index 9a357651..a470edd6 100644 --- a/video_xblock/static/css/transcripts.css +++ b/video_xblock/static/css/transcripts.css @@ -24,12 +24,15 @@ #transcript { max-height: 100%; overflow: scroll; - padding: 0 0 0 20px; font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 14px; background-color: inherit; } +.transcript-body { + padding: 0 0 0 20px; +} + .transcript-line { margin-bottom: 8px; border: 0; diff --git a/video_xblock/static/css/videojs.css b/video_xblock/static/css/videojs.css index 68ae627a..840bb837 100644 --- a/video_xblock/static/css/videojs.css +++ b/video_xblock/static/css/videojs.css @@ -323,12 +323,15 @@ body { #transcript { max-height: 100%; overflow: scroll; - padding: 0 0 0 20px; font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 14px; background-color: inherit; } +.transcript-body { + padding: 0 0 0 20px; +} + .transcript-line { margin-bottom: 8px; border: 0; diff --git a/video_xblock/static/js/videojs-transcript.js b/video_xblock/static/js/videojs-transcript.js index 0805a2ae..4fdcfa3e 100644 --- a/video_xblock/static/js/videojs-transcript.js +++ b/video_xblock/static/js/videojs-transcript.js @@ -1,6 +1,5 @@ domReady(function() { videojs('{{ video_player_id }}').ready(function(){ - // fire up the plugin var transcript = this.transcript({ 'showTrackSelector': false,