(
State(state): State<AppState>,
Path(udid): Path<String>,
Json(payload): Json<ScreenRecordingPayload>,
)
| 2495 | } |
| 2496 | |
| 2497 | async fn screen_recording( |
| 2498 | State(state): State<AppState>, |
| 2499 | Path(udid): Path<String>, |
| 2500 | Json(payload): Json<ScreenRecordingPayload>, |
| 2501 | ) -> Result<(StatusCode, HeaderMap, Vec<u8>), AppError> { |
| 2502 | let seconds = validate_screen_recording_seconds(payload.seconds)?; |
| 2503 | if android::is_android_id(&udid) { |
| 2504 | return Err(AppError::bad_request( |
| 2505 | "Screen recording is currently supported for iOS simulators only.", |
| 2506 | )); |
| 2507 | } |
| 2508 | let mp4 = run_bridge_action(state, move |bridge| { |
| 2509 | bridge.screen_recording_mp4(&udid, seconds) |
| 2510 | }) |
| 2511 | .await?; |
| 2512 | let mut headers = HeaderMap::new(); |
| 2513 | headers.insert(header::CONTENT_TYPE, "video/mp4".parse().unwrap()); |
| 2514 | headers.insert( |
| 2515 | header::CACHE_CONTROL, |
| 2516 | "no-cache, no-store, must-revalidate".parse().unwrap(), |
| 2517 | ); |
| 2518 | Ok((StatusCode::OK, headers, mp4)) |
| 2519 | } |
| 2520 | |
| 2521 | async fn start_screen_recording( |
| 2522 | State(state): State<AppState>, |
nothing calls this directly
no test coverage detected