From 72d7c9ca97e65949620d908f761c7ff8ee522bf7 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Wed, 12 Jun 2013 11:57:54 +0300 Subject: [PATCH] Moved the definition of autoplay attribute to videoalpha_module.py file. Changed double negative if statement for autoplay check to simple if. --- .../xmodule/js/src/videoalpha/display/video_player.coffee | 2 +- common/lib/xmodule/xmodule/videoalpha_module.py | 4 +++- lms/templates/videoalpha.html | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee b/common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee index 9217784a26..13c7614483 100644 --- a/common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee +++ b/common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee @@ -99,7 +99,7 @@ class @VideoPlayerAlpha extends SubviewAlpha @video.log 'load_video' if @video.videoType is 'html5' @player.setPlaybackRate @video.speed - unless onTouchBasedDevice() or $('.video:first').data('autoplay') == 'False' + if not onTouchBasedDevice() and $('.video:first').data('autoplay') is 'True' $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => diff --git a/common/lib/xmodule/xmodule/videoalpha_module.py b/common/lib/xmodule/xmodule/videoalpha_module.py index 92cd176af7..43de021799 100644 --- a/common/lib/xmodule/xmodule/videoalpha_module.py +++ b/common/lib/xmodule/xmodule/videoalpha_module.py @@ -5,6 +5,7 @@ from lxml import etree from pkg_resources import resource_string, resource_listdir from django.http import Http404 +from django.conf import settings from xmodule.x_module import XModule from xmodule.raw_module import RawDescriptor @@ -147,7 +148,8 @@ class VideoAlphaModule(VideoAlphaFields, XModule): 'caption_asset_path': caption_asset_path, 'show_captions': self.show_captions, 'start': self.start_time, - 'end': self.end_time + 'end': self.end_time, + 'autoplay': settings.MITX_FEATURES.get('AUTOPLAY_VIDEOS', True) }) diff --git a/lms/templates/videoalpha.html b/lms/templates/videoalpha.html index fff251de51..07c7dbee27 100644 --- a/lms/templates/videoalpha.html +++ b/lms/templates/videoalpha.html @@ -18,7 +18,7 @@ data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}" - data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}" + data-autoplay="${autoplay}" >