(
State(state): State<AppState>,
Path((udid, recording_id)): Path<(String, String)>,
)
| 2536 | } |
| 2537 | |
| 2538 | async fn stop_screen_recording( |
| 2539 | State(state): State<AppState>, |
| 2540 | Path((udid, recording_id)): Path<(String, String)>, |
| 2541 | ) -> Result<(StatusCode, HeaderMap, Vec<u8>), AppError> { |
| 2542 | if android::is_android_id(&udid) { |
| 2543 | return Err(AppError::bad_request( |
| 2544 | "Screen recording is currently supported for iOS simulators only.", |
| 2545 | )); |
| 2546 | } |
| 2547 | let mp4 = run_bridge_action(state, move |bridge| { |
| 2548 | bridge.stop_screen_recording(&recording_id) |
| 2549 | }) |
| 2550 | .await?; |
| 2551 | let mut headers = HeaderMap::new(); |
| 2552 | headers.insert(header::CONTENT_TYPE, "video/mp4".parse().unwrap()); |
| 2553 | headers.insert( |
| 2554 | header::CACHE_CONTROL, |
| 2555 | "no-cache, no-store, must-revalidate".parse().unwrap(), |
| 2556 | ); |
| 2557 | Ok((StatusCode::OK, headers, mp4)) |
| 2558 | } |
| 2559 | |
| 2560 | fn validate_screen_recording_seconds(seconds: Option<f64>) -> Result<f64, AppError> { |
| 2561 | let seconds = seconds.unwrap_or(5.0); |
nothing calls this directly
no test coverage detected