本文整理汇总了Python中gaiatest.apps.videoplayer.app.VideoPlayer类的典型用法代码示例。如果您正苦于以下问题:Python VideoPlayer类的具体用法?Python VideoPlayer怎么用?Python VideoPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VideoPlayer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_play_3gp_video
def test_play_3gp_video(self):
"""https://moztrap.mozilla.org/manage/case/2478/"""
video_player = VideoPlayer(self.marionette)
video_player.launch()
# Assert that there is at least one video available
self.assertGreater(video_player.total_video_count, 0)
first_video_name = video_player.first_video_name
# Click on the first video.
fullscreen_video = video_player.tap_first_video_item()
# Video will play automatically
# We'll wait for the controls to clear so we're 'safe' to proceed
time.sleep(2)
# We cannot tap the toolbar so let's just enable it with javascript
fullscreen_video.display_controls_with_js()
# The elapsed time > 0:00 denote the video is playing
zero_time = time.strptime('00:00', '%M:%S')
self.assertGreater(fullscreen_video.elapsed_time, zero_time)
# Check the name too. This will only work if the toolbar is visible.
self.assertEqual(first_video_name, fullscreen_video.name)
示例2: test_empty_video
def test_empty_video(self):
"""https://moztrap.mozilla.org/manage/case/3660/
Requires to be no videos on SDCard, which is the default.
"""
video_player = VideoPlayer(self.marionette)
video_player.launch()
# Verify title when no videos
self.assertEqual(video_player.empty_video_title, "Add videos to get started")
# Verify text when no videos
# Note: Text will need to be updated if/when Bug 834477 is fixed
self.assertEqual(video_player.empty_video_text, "Load videos on to the memory card.")
示例3: test_play_3gp_video
def test_play_3gp_video(self):
"""https://moztrap.mozilla.org/manage/case/2478/"""
video_player = VideoPlayer(self.marionette)
video_player.launch()
video_player.wait_for_thumbnails_to_load(1)
# Assert that there is at least one video available
self.assertGreater(video_player.total_video_count, 0)
first_video_name = video_player.first_video_name
self.assertEqual('none', self.data_layer.current_audio_channel)
# See bug 1109203, current_audio_channel switches context to the system
# app, so we need to return it back to the displayed app
self.apps.switch_to_displayed_app()
# Click on the first video.
fullscreen_video = video_player.tap_first_video_item()
# Video will play automatically
# We'll wait for the controls to clear so we're 'safe' to proceed
time.sleep(2)
# We cannot tap the toolbar so let's just enable it with javascript
fullscreen_video.show_controls()
# The elapsed time > 0:00 denote the video is playing
zero_time = time.strptime('00:00', '%M:%S')
self.assertGreater(fullscreen_video.elapsed_time, zero_time)
# Check the name too. This will only work if the toolbar is visible.
self.assertEqual(first_video_name, fullscreen_video.name)
self.assertEqual('content', self.data_layer.current_audio_channel)
示例4: test_play_mp4_video
def test_play_mp4_video(self):
"""https://moztrap.mozilla.org/manage/case/2478/"""
video_player = VideoPlayer(self.marionette)
video_player.launch()
video_player.wait_for_thumbnails_to_load(1, "Video files found on device: %s" % self.data_layer.video_files)
# Assert that there is at least one video available
self.assertGreater(video_player.total_video_count, 0)
first_video_name = video_player.first_video_name
self.assertEqual("none", self.data_layer.current_audio_channel)
self.apps.switch_to_displayed_app()
# Click on the first video.
fullscreen_video = video_player.tap_first_video_item()
# Video will play automatically
# We'll wait for the controls to clear so we're 'safe' to proceed
time.sleep(2)
# We cannot tap the toolbar so let's just enable it with javascript
fullscreen_video.show_controls()
# The elapsed time > 0:00 denote the video is playing
zero_time = time.strptime("00:00", "%M:%S")
self.assertGreater(fullscreen_video.elapsed_time, zero_time)
# Check the name too. This will only work if the toolbar is visible.
self.assertEqual(first_video_name, fullscreen_video.name)
self.assertEqual("content", self.data_layer.current_audio_channel)
示例5: video_playback
def video_playback(self, screen_flag):
self.push_resource(os.path.abspath('source/meetthecubs.webm'))
lock_screen = LockScreen(self.marionette)
homescreen = lock_screen.unlock()
self.wait_for_condition(lambda m: self.apps.displayed_app.name == homescreen.name)
video_player = VideoPlayer(self.marionette)
video_player.launch()
video_player.wait_for_thumbnails_to_load(1, 'Video files found on device: %s' %self.data_layer.video_files)
# Assert that there is at least one video available
self.assertGreater(video_player.total_video_count, 0)
first_video_name = video_player.first_video_name
self.assertEqual('none', self.data_layer.current_audio_channel)
self.apps.switch_to_displayed_app()
# Click on the first video
fullscreen_video = video_player.tap_first_video_item()
# Video will play automatically
# We'll wait for the controls to clear so we're 'safe' to proceed
time.sleep(2)
# We cannot tap the toolbar so let's just enable it with javascript
fullscreen_video.show_controls()
# The elapsed time > 0:00 denote the video is playing
zero_time = time.strptime('00:00', '%M:%S')
self.assertGreater(fullscreen_video.elapsed_time, zero_time)
# Check the name too. This will only work if the toolbar is visible
self.assertEqual(first_video_name, fullscreen_video.name)
self.assertEqual('content', self.data_layer.current_audio_channel)
print ""
if screen_flag:
print "Running Video Test (screen on)"
test_name = "video_playback"
else:
self.device.turn_screen_off()
print "Running Video Test (screen off)"
test_name = "background_video_playback"
time.sleep(2)
fullscreen_video.tap_play() #when you turn off the screen, video playback pauses...
self.runPowerTest(test_name, "Video", "video")
示例6: test_play_3gp_video
def test_play_3gp_video(self):
"""https://moztrap.mozilla.org/manage/case/2478/"""
video_player = VideoPlayer(self.marionette)
video_player.launch()
video_player.wait_for_thumbnails_to_load(1)
# Assert that there is at least one video available
self.assertGreater(video_player.total_video_count, 0)
first_video_name = video_player.first_video_name
self.take_screenshot()
# Click on the first video.
fullscreen_video = video_player.tap_first_video_item()
# Video will play automatically
# After playback, it rewinds to the beginning. The video file is 13 seconds long
time.sleep(self._video_length + 3) # add 3 seconds to compensate for the lag
begin_time = time.strptime('00:00', '%M:%S')
# display the data overlay to show the elapsed time
fullscreen_video.show_controls()
self.assertEqual(fullscreen_video.elapsed_time, begin_time)
self.assertEqual(first_video_name, fullscreen_video.name)
self.take_screenshot()
# take snapshot of random frames
fullscreen_video.tap_forward() # tapping forward or rewinds moves frames in 10 sec increment
self.take_screenshot()
fullscreen_video.tap_forward() # go to the end of the frame
self.take_screenshot()
# go back to the beginning by tapping rewind twice, since each tap is in 10 second increment
fullscreen_video.tap_rewind()
# wait until the elapsed_time goes 10 seconds back
Wait(self.marionette).until(lambda m: fullscreen_video.elapsed_time == time.strptime('00:03', '%M:%S'))
fullscreen_video.tap_rewind()
# wait until the counter goes back to the beginning
Wait(self.marionette).until(lambda m: fullscreen_video.elapsed_time == begin_time)
# seek forward
fullscreen_video.move_seek_slider(100)
self.take_screenshot()
# seek backward
fullscreen_video.move_seek_slider(-50)
self.take_screenshot()