def record_video(device, state): recorder = video_recorder.VideoRecorder(device) with recorder: state.WaitForSignal() if state.recording_path: f = recorder.Pull(state.recording_path) logging.info('Video written to %s' % os.path.abspath(f))
def __init__(self, browser_backend, platform_backend, output_path, state): super(AndroidScreenRecordingProfiler, self).__init__(browser_backend, platform_backend, output_path, state) self._output_path = output_path + '.mp4' self._recorder = video_recorder.VideoRecorder( browser_backend.device, megabits_per_second=_VIDEO_MEGABITS_PER_SECOND) self._recorder.Start()
def StartVideoCapture(self, min_bitrate_mbps): """Starts the video capture at specified bitrate.""" min_bitrate_mbps = max(min_bitrate_mbps, 0.1) if min_bitrate_mbps > 100: raise ValueError('Android video capture cannot capture at %dmbps. ' 'Max capture rate is 100mbps.' % min_bitrate_mbps) if self.is_video_capture_running: self._video_recorder.Stop() self._video_recorder = video_recorder.VideoRecorder( self._device, megabits_per_second=min_bitrate_mbps) self._video_recorder.Start(timeout=5)