1# Copyright 2015 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5 6from autotest_lib.client.cros.video import video_player 7 8 9class VimeoPlayer(video_player.VideoPlayer): 10 """ 11 Provides an interface to interact with vimeo player on a chrome device. 12 13 """ 14 15 16 def is_video_ready(self): 17 """ 18 Determines if a vimeo video is ready by using javascript. 19 20 returns: bool, True if video is ready, else False. 21 22 """ 23 return self.tab.EvaluateJavaScript('%s.isready' % self.video_id) 24 25 26 def play(self): 27 """ 28 Plays the vimeo video 29 30 """ 31 self.tab.ExecuteJavaScript('%s.play()' % self.video_id) 32 33 34 def seek_to(self, t): 35 """ 36 Seeks a vimeo video to a time stamp. 37 38 @param t: timedelta, time value to seek to. 39 40 """ 41 self.tab.EvaluateJavaScript('%s.seekTo(%d)' % (self.video_id, 42 int(t.total_seconds()))) 43 44 def has_video_finished_seeking(self): 45 """ 46 Determines if a vimeo video has finished seeking. 47 48 """ 49 return self.tab.EvaluateJavaScript('%s.seeked' % self.video_id)