Orchard.SimulatorStream (orchard v0.1.7)

View Source

Provides video capture capabilities for iOS simulators.

Since iOS simulators don't expose real-time video streams, this module provides two approaches:

  1. Screenshot-based streaming: Captures screenshots at intervals and encodes them into a video stream. Good for basic use cases but has performance limitations.

  2. Window capture via FFmpeg: Uses FFmpeg's AVFoundation to capture the simulator window directly. Better performance but requires knowing the window title.

For production use cases requiring true real-time streaming, consider:

  • Facebook's idb tool which can access the simulator's IOSurface
  • Custom ScreenCaptureKit implementation (macOS 12.3+)

Summary

Functions

Records video using simctl (file-based only).

Starts screenshot-based video streaming from a simulator.

Starts window-based video capture using FFmpeg's AVFoundation.

Stops a video capture/recording process.

Functions

record_video(simulator_udid, output_path, opts \\ [])

Records video using simctl (file-based only).

This is the native iOS simulator recording capability. It records to a file and cannot stream in real-time.

start_screenshot_stream(simulator_udid, opts \\ [])

Starts screenshot-based video streaming from a simulator.

This method captures screenshots at ~30 FPS and pipes them through FFmpeg to create an H264 video stream.

Options:

  • :output - Output destination (file path or URL)
  • :fps - Frames per second (default: 30)
  • :duration - Maximum duration in seconds (optional)

start_window_capture(simulator_name, opts \\ [])

Starts window-based video capture using FFmpeg's AVFoundation.

This method captures the simulator window directly, providing better performance than screenshot-based capture.

Options:

  • :output - Output destination (file path or URL)
  • :window_title - Simulator window title (e.g., "iPhone 15 — iOS 18.0")
  • :fps - Frames per second (default: 30)
  • :duration - Maximum duration in seconds (optional)

stop_capture(map)

Stops a video capture/recording process.