OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import tempfile | 7 import tempfile |
8 import time | 8 import time |
9 | 9 |
10 from pylib import cmd_helper | 10 from devil.android import device_errors |
11 from pylib import device_signal | 11 from devil.android import device_signal |
12 from pylib.device import device_errors | 12 from devil.utils import cmd_helper |
13 | |
14 import pylib.device.device_utils | |
15 | 13 |
16 | 14 |
17 class VideoRecorder(object): | 15 class VideoRecorder(object): |
18 """Records a screen capture video from an Android Device (KitKat or newer). | 16 """Records a screen capture video from an Android Device (KitKat or newer). |
19 | 17 |
20 Args: | 18 Args: |
21 device: DeviceUtils instance. | 19 device: DeviceUtils instance. |
22 host_file: Path to the video file to store on the host. | 20 host_file: Path to the video file to store on the host. |
23 megabits_per_second: Video bitrate in megabits per second. Allowed range | 21 megabits_per_second: Video bitrate in megabits per second. Allowed range |
24 from 0.1 to 100 mbps. | 22 from 0.1 to 100 mbps. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 # TODO(jbudorick): Merge filename generation with the logic for doing so in | 83 # TODO(jbudorick): Merge filename generation with the logic for doing so in |
86 # DeviceUtils. | 84 # DeviceUtils. |
87 host_file_name = ( | 85 host_file_name = ( |
88 host_file | 86 host_file |
89 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', | 87 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', |
90 time.localtime())) | 88 time.localtime())) |
91 host_file_name = os.path.abspath(host_file_name) | 89 host_file_name = os.path.abspath(host_file_name) |
92 self._device.PullFile(self._device_file, host_file_name) | 90 self._device.PullFile(self._device_file, host_file_name) |
93 self._device.RunShellCommand('rm -f "%s"' % self._device_file) | 91 self._device.RunShellCommand('rm -f "%s"' % self._device_file) |
94 return host_file_name | 92 return host_file_name |
OLD | NEW |