Membrane.RTC.Engine.Endpoint.Recording.Storage behaviour (Membrane RTC Engine Recording Endpoint v0.3.0)

View Source

An interface for Recording endpoint storage configuration.

Summary

Callbacks

Callback invoked when a new track is added to RecordingEndpoint. It should return a struct that will be further added as a child to the spec.

This callback gets invoked exclusively when FileStorage is in use and a recording session is being closed. Within this callback, you can perform the following actions

Callback invoked once all tracks have been processed by RecordingEndpoint. The returned object can be of two types

Types

files()

@type files() :: %{
  required(filename :: String.t()) => {Path.t(), size :: pos_integer()}
}

object_config()

@type object_config() :: %{
  object: binary(),
  recording_id: String.t(),
  filename: String.t()
}

recording_config()

@type recording_config() :: %{
  track: Membrane.RTC.Engine.Track.t(),
  recording_id: String.t(),
  filename: String.t()
}

Callbacks

get_sink(recording_config, opts)

@callback get_sink(recording_config :: recording_config(), opts :: any()) :: struct()

Callback invoked when a new track is added to RecordingEndpoint. It should return a struct that will be further added as a child to the spec.

on_close(file_config, recording_id, opts)

@callback on_close(file_config :: files(), recording_id :: String.t(), opts :: any()) ::
  :ok | :error

This callback gets invoked exclusively when FileStorage is in use and a recording session is being closed. Within this callback, you can perform the following actions:

  • Clean up all resources
  • Attempt to rectify any discrepancies between the saved objects and local files

If error is returned report won't be sent to the storage.

save_object(object_config, opts)

@callback save_object(object_config :: object_config(), opts :: any()) ::
  :ok | {:error, String.t()}

Callback invoked once all tracks have been processed by RecordingEndpoint. The returned object can be of two types:

  • report - a file containing all the necessary information for deserializing the processed tracks.
  • recording - a file that captures a complete track recording.