Merge pull request #17 from edx/peter-fogg/no-autoplay-studio
Peter fogg/no autoplay studio
This commit is contained in:
@@ -28,7 +28,6 @@ def click_component_from_menu(instance_id, expected_css):
|
||||
world.css_click(elem_css)
|
||||
assert_equal(1, len(world.css_find(expected_css)))
|
||||
|
||||
|
||||
@world.absorb
|
||||
def edit_component_and_select_settings():
|
||||
world.css_click('a.edit-button')
|
||||
|
||||
6
cms/djangoapps/contentstore/features/video.feature
Normal file
6
cms/djangoapps/contentstore/features/video.feature
Normal file
@@ -0,0 +1,6 @@
|
||||
Feature: Video Component
|
||||
As a course author, I want to be able to view my created videos in Studio.
|
||||
|
||||
Scenario: Autoplay is disabled in Studio
|
||||
Given I have created a Video component
|
||||
Then when I view the video it does not have autoplay enabled
|
||||
11
cms/djangoapps/contentstore/features/video.py
Normal file
11
cms/djangoapps/contentstore/features/video.py
Normal file
@@ -0,0 +1,11 @@
|
||||
#pylint: disable=C0111
|
||||
|
||||
from lettuce import world, step
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
|
||||
@step('when I view the video it does not have autoplay enabled')
|
||||
def does_not_autoplay(step):
|
||||
assert world.css_find('.video')[0]['data-autoplay'] == 'False'
|
||||
assert world.css_find('.video_control')[0].has_class('play')
|
||||
@@ -40,7 +40,10 @@ MITX_FEATURES = {
|
||||
'SEGMENT_IO': True,
|
||||
|
||||
# Enable URL that shows information about the status of various services
|
||||
'ENABLE_SERVICE_STATUS': False
|
||||
'ENABLE_SERVICE_STATUS': False,
|
||||
|
||||
# Don't autoplay videos for course authors
|
||||
'AUTOPLAY_VIDEOS': False
|
||||
}
|
||||
ENABLE_JASMINE = False
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
<a href="#" id="${location}" data-location="${location}">
|
||||
<span class="name"> ${name}</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
@@ -66,7 +66,7 @@ class @VideoPlayer extends Subview
|
||||
at: 'top center'
|
||||
|
||||
onReady: (event) =>
|
||||
unless onTouchBasedDevice()
|
||||
unless onTouchBasedDevice() or $('.video:first').data('autoplay') == 'False'
|
||||
$('.video-load-complete:first').data('video').player.play()
|
||||
|
||||
onStateChange: (event) =>
|
||||
|
||||
@@ -20,7 +20,7 @@ logger = getLogger(__name__)
|
||||
|
||||
TEST_COURSE_ORG = 'edx'
|
||||
TEST_COURSE_NAME = 'Test Course'
|
||||
TEST_SECTION_NAME = "Problem"
|
||||
TEST_SECTION_NAME = 'Test Section'
|
||||
|
||||
|
||||
@step(u'The course "([^"]*)" exists$')
|
||||
|
||||
6
lms/djangoapps/courseware/features/video.feature
Normal file
6
lms/djangoapps/courseware/features/video.feature
Normal file
@@ -0,0 +1,6 @@
|
||||
Feature: Video component
|
||||
As a student, I want to view course videos in LMS.
|
||||
|
||||
Scenario: Autoplay is enabled in LMS
|
||||
Given the course has a Video component
|
||||
Then when I view the video it has autoplay enabled
|
||||
34
lms/djangoapps/courseware/features/video.py
Normal file
34
lms/djangoapps/courseware/features/video.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#pylint: disable=C0111
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce.django import django_url
|
||||
from common import TEST_COURSE_NAME, TEST_SECTION_NAME, i_am_registered_for_the_course, section_location
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
|
||||
@step('when I view the video it has autoplay enabled')
|
||||
def does_autoplay(step):
|
||||
assert(world.css_find('.video')[0]['data-autoplay'] == 'True')
|
||||
|
||||
|
||||
@step('the course has a Video component')
|
||||
def view_video(step):
|
||||
coursename = TEST_COURSE_NAME.replace(' ', '_')
|
||||
i_am_registered_for_the_course(step, coursename)
|
||||
|
||||
# Make sure we have a video
|
||||
add_video_to_course(coursename)
|
||||
chapter_name = TEST_SECTION_NAME.replace(" ", "_")
|
||||
section_name = chapter_name
|
||||
url = django_url('/courses/edx/Test_Course/Test_Course/courseware/%s/%s' %
|
||||
(chapter_name, section_name))
|
||||
|
||||
world.browser.visit(url)
|
||||
|
||||
|
||||
def add_video_to_course(course):
|
||||
template_name = 'i4x://edx/templates/video/default'
|
||||
world.ItemFactory.create(parent_location=section_location(course),
|
||||
template=template_name,
|
||||
display_name='Video')
|
||||
@@ -113,7 +113,10 @@ MITX_FEATURES = {
|
||||
'ENABLE_SERVICE_STATUS': False,
|
||||
|
||||
# Toggle to indicate use of a custom theme
|
||||
'USE_CUSTOM_THEME': False
|
||||
'USE_CUSTOM_THEME': False,
|
||||
|
||||
# Do autoplay videos for students
|
||||
'AUTOPLAY_VIDEOS': True
|
||||
}
|
||||
|
||||
# Used for A/B testing
|
||||
|
||||
@@ -3,8 +3,24 @@
|
||||
% endif
|
||||
|
||||
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||
<div id="stub_out_video_for_testing"></div>
|
||||
|
||||
<div id="stub_out_video_for_testing">
|
||||
<div class="video" data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}">
|
||||
<section class="video-controls">
|
||||
<div class="slider"></div>
|
||||
<div>
|
||||
<ul class="vcr">
|
||||
<li><a class="video_control" href="#"></a></li>
|
||||
<li>
|
||||
<div class="vidtime">0:00 / 0:00</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="secondary-controls">
|
||||
<a href="#" class="add-fullscreen" title="Fill browser">Fill Browser</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
%elif settings.MITX_FEATURES.get('USE_YOUTUBE_OBJECT_API') and normal_speed_video_id:
|
||||
<object width="640" height="390">
|
||||
<param name="movie"
|
||||
@@ -16,7 +32,7 @@
|
||||
width="640" height="390"></embed>
|
||||
</object>
|
||||
%else:
|
||||
<div id="video_${id}" class="video" data-streams="${streams}" data-show-captions="${show_captions}" data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}">
|
||||
<div id="video_${id}" class="video" data-streams="${streams}" data-show-captions="${show_captions}" data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}" data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}">
|
||||
<div class="tc-wrapper">
|
||||
<article class="video-wrapper">
|
||||
<section class="video-player">
|
||||
|
||||
Reference in New Issue
Block a user