(
&self,
udid: &str,
duration_seconds: f64,
)
| 518 | } |
| 519 | |
| 520 | pub fn screen_recording_mp4( |
| 521 | &self, |
| 522 | udid: &str, |
| 523 | duration_seconds: f64, |
| 524 | ) -> Result<Vec<u8>, AppError> { |
| 525 | let udid = CString::new(udid).map_err(|e| AppError::bad_request(e.to_string()))?; |
| 526 | unsafe { |
| 527 | let mut error = ptr::null_mut(); |
| 528 | let bytes = |
| 529 | ffi::xcw_native_screen_recording_mp4(udid.as_ptr(), duration_seconds, &mut error); |
| 530 | if bytes.data.is_null() { |
| 531 | return Err( |
| 532 | take_error(error).unwrap_or_else(|| AppError::native("Unknown native error.")) |
| 533 | ); |
| 534 | } |
| 535 | let data = std::slice::from_raw_parts(bytes.data, bytes.length).to_vec(); |
| 536 | ffi::xcw_native_free_bytes(bytes); |
| 537 | Ok(data) |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | pub fn start_screen_recording(&self, udid: &str) -> Result<String, AppError> { |
| 542 | let udid = CString::new(udid).map_err(|e| AppError::bad_request(e.to_string()))?; |
no test coverage detected