PhoenixReplay.Export.Options (PhoenixReplay v0.6.2)

Copy Markdown View Source

What a video export shows and how it is encoded, as the player's export dialog and mix phoenix_replay.export choose it.

  • :from and :to — the range of the recording, in milliseconds; nil for its start or end
  • :skip_idle — shorten stretches without activity to the :idle configured
  • :pointer — draw the pointer; the page scrolls as recorded either way
  • :size — :recorded, the recorded pixel ratio up to :max_dpr; :one, one pixel per CSS pixel; or :half, half of that
  • :fps — frames per second: 15, 30 or 60
  • :quality — :small, :balanced or :best; :balanced is the configured :crf, and the others trade it for size or detail

The defaults follow the :export configuration.

Summary

Functions

The :export configuration the options make: the frame rate, the idle time, the pixel ratio, the quality and a :scale for the encoder.

The frame rates offered.

Reads options written by to_map/1.

The defaults the :export configuration sets.

Reads options from string params, as a form or command-line flags send them, onto the defaults: "from" and "to" in seconds, "skip_idle", and "pointer" as "true" or "false", "size" as "recorded", "1x" or "half", "fps", and "quality" as "small", "balanced" or "best". Missing params keep the defaults.

The options as a map of strings and numbers, for a job queue that stores them as JSON, such as PhoenixReplay.Export.Queue.Oban; from_map/1 reads it back.

Types

quality()

@type quality() :: :small | :balanced | :best

size()

@type size() :: :recorded | :one | :half

t()

@type t() :: %PhoenixReplay.Export.Options{
  fps: pos_integer(),
  from: non_neg_integer() | nil,
  pointer: boolean(),
  quality: quality(),
  size: size(),
  skip_idle: boolean(),
  to: non_neg_integer() | nil
}

Functions

apply(options, export)

@spec apply(t(), PhoenixReplay.Config.export()) :: map()

The :export configuration the options make: the frame rate, the idle time, the pixel ratio, the quality and a :scale for the encoder.

frame_rates()

@spec frame_rates() :: [pos_integer()]

The frame rates offered.

from_map(map)

@spec from_map(%{required(String.t()) => term()}) :: t()

Reads options written by to_map/1.

new(export)

@spec new(PhoenixReplay.Config.export()) :: t()

The defaults the :export configuration sets.

parse(params, export)

@spec parse(map(), PhoenixReplay.Config.export()) :: {:ok, t()} | {:error, String.t()}

Reads options from string params, as a form or command-line flags send them, onto the defaults: "from" and "to" in seconds, "skip_idle", and "pointer" as "true" or "false", "size" as "recorded", "1x" or "half", "fps", and "quality" as "small", "balanced" or "best". Missing params keep the defaults.

to_map(options)

@spec to_map(t()) :: %{required(String.t()) => term()}

The options as a map of strings and numbers, for a job queue that stores them as JSON, such as PhoenixReplay.Export.Queue.Oban; from_map/1 reads it back.