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 devil.android import device_errors | |
11 from devil.android import device_signal | 10 from devil.android import device_signal |
12 from devil.utils import cmd_helper | 11 from devil.utils import cmd_helper |
13 | 12 |
14 | 13 |
15 class VideoRecorder(object): | 14 class VideoRecorder(object): |
16 """Records a screen capture video from an Android Device (KitKat or newer). | 15 """Records a screen capture video from an Android Device (KitKat or newer). |
17 | 16 |
18 Args: | 17 Args: |
19 device: DeviceUtils instance. | 18 device: DeviceUtils instance. |
20 host_file: Path to the video file to store on the host. | 19 host_file: Path to the video file to store on the host. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 # TODO(jbudorick): Merge filename generation with the logic for doing so in | 82 # TODO(jbudorick): Merge filename generation with the logic for doing so in |
84 # DeviceUtils. | 83 # DeviceUtils. |
85 host_file_name = ( | 84 host_file_name = ( |
86 host_file | 85 host_file |
87 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', | 86 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', |
88 time.localtime())) | 87 time.localtime())) |
89 host_file_name = os.path.abspath(host_file_name) | 88 host_file_name = os.path.abspath(host_file_name) |
90 self._device.PullFile(self._device_file, host_file_name) | 89 self._device.PullFile(self._device_file, host_file_name) |
91 self._device.RunShellCommand('rm -f "%s"' % self._device_file) | 90 self._device.RunShellCommand('rm -f "%s"' % self._device_file) |
92 return host_file_name | 91 return host_file_name |
OLD | NEW |