From fe849dedd91f62c41dc8231ee1e4082ff8f1f35e Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Thu, 31 May 2012 16:28:19 -0400 Subject: [PATCH] Do not display play/pause button on iOS Device iOS devices has a restriction that user has to click on the video element to initiate playback. By visually disable the button, user will be forced to click on the video itself, and everything will be worked as expected. Fixes https://www.pivotaltracker.com/story/show/30334381 --- .../modules/video/video_control_spec.coffee | 89 ++++++++++++++----- .../src/modules/video/video_control.coffee | 16 ++-- 2 files changed, 78 insertions(+), 27 deletions(-) diff --git a/static/coffee/spec/modules/video/video_control_spec.coffee b/static/coffee/spec/modules/video/video_control_spec.coffee index a912abb2d0..0c8615b8f7 100644 --- a/static/coffee/spec/modules/video/video_control_spec.coffee +++ b/static/coffee/spec/modules/video/video_control_spec.coffee @@ -1,17 +1,16 @@ describe 'VideoControl', -> beforeEach -> @player = jasmine.stubVideoPlayer @ + $('.video-controls').html '' describe 'constructor', -> - beforeEach -> - @control = new VideoControl @player - it 'render the video controls', -> + new VideoControl @player expect($('.video-controls').html()).toContain '''
- """ + """ + + unless onTouchBasedDevice() + @$('.video_control').addClass('play').html('Play') onPlay: => @$('.video_control').removeClass('play').addClass('pause').html('Pause') @@ -36,7 +39,8 @@ class @VideoControl togglePlayback: (event) => event.preventDefault() - if @player.isPlaying() - $(@player).trigger('pause') - else - $(@player).trigger('play') + if $('.video_control').hasClass('play') || $('.video_control').hasClass('pause') + if @player.isPlaying() + $(@player).trigger('pause') + else + $(@player).trigger('play')