PhoenixReplay.Export.Schedule (PhoenixReplay v0.6.2)

Copy Markdown View Source

Which moments of a recording a video shows, and for how long.

The video runs at a constant frame rate from the first render to the end of the recording or its pointer track, and holds the last moment for :hold milliseconds so it is seen. Each frame shows the moment of the recording it falls on, except that a stretch without activity longer than :idle is shortened to :idle, half of it after the activity before and half before the activity after.

Consecutive frames that would look the same share one shot/0: the same event, the same scroll position, the same pointer presses and moves, and no pointer animation running. While the pointer moves, and for as long as its trail and press ripples take to fade, every frame is a shot of its own. So capturing takes a screenshot per shot, not per frame.

Summary

Types

One screenshot: the event index and the moment at of the recording to show, the viewport the page had, with its media features when they were recorded (see PhoenixReplay.Recording.Client.media/1), and how many frames it lasts.

t()

The shots in order, the canvas every viewport fits in, in CSS pixels, the device pixel ratio to render at, and the frame rate.

Functions

The video's length in milliseconds.

The number of frames in the video.

Plans the video of a recording laid out by PhoenixReplay.Recording.Timeline.for_playback/1 and its pointer track.

Types

shot()

@type shot() :: %{
  index: non_neg_integer(),
  at: non_neg_integer(),
  viewport: %{
    :width => pos_integer(),
    :height => pos_integer(),
    optional(:media) => %{required(String.t()) => String.t()}
  },
  frames: pos_integer()
}

One screenshot: the event index and the moment at of the recording to show, the viewport the page had, with its media features when they were recorded (see PhoenixReplay.Recording.Client.media/1), and how many frames it lasts.

t()

@type t() :: %PhoenixReplay.Export.Schedule{
  canvas: %{width: pos_integer(), height: pos_integer()},
  dpr: number(),
  fps: pos_integer(),
  shots: [shot()]
}

The shots in order, the canvas every viewport fits in, in CSS pixels, the device pixel ratio to render at, and the frame rate.

Functions

duration_ms(schedule)

@spec duration_ms(t()) :: non_neg_integer()

The video's length in milliseconds.

frames(schedule)

@spec frames(t()) :: non_neg_integer()

The number of frames in the video.

new(recording, track, opts)

Plans the video of a recording laid out by PhoenixReplay.Recording.Timeline.for_playback/1 and its pointer track.

Options

  • :fps — frames per second (required)
  • :idle — milliseconds a stretch without activity is shortened to, or nil to keep it whole (required)
  • :max_dpr — the highest device pixel ratio to render at (required)
  • :hold — milliseconds the last moment is held (required)
  • :from and :to — the range of the recording to show, in milliseconds; nil for its first render and its end