Skip to content

Commit b2e44a5

Browse files
committed
Bind success typing of end_tracks
1 parent 28bb23b commit b2e44a5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

lib/ex_webrtc_recorder.ex

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ defmodule ExWebRTC.Recorder do
4848
{:upload_complete, S3.upload_task_ref(), __MODULE__.Manifest.t()}
4949
| {:upload_failed, S3.upload_task_ref(), __MODULE__.Manifest.t()}}
5050

51+
@typedoc """
52+
Tuple returned on successful call to `end_tracks/2`.
53+
54+
Contains the part of the recording manifest that's relevant to the freshly ended tracks.
55+
See `t:ExWebRTC.Recorder.Manifest.t/0` for more info.
56+
57+
If uploads are configured:
58+
* Contains the reference to the upload task that was spawned.
59+
* Recorder will send the `:upload_complete`/`:upload_failed` message with this reference
60+
to its controlling process when the task finishes.
61+
62+
Note that the manifest returned by `end_tracks/2` always contains local paths to files.
63+
The updated manifest with `s3://` scheme URLs is sent in the aforementioned message.
64+
"""
65+
@type end_tracks_ok_result :: {:ok, __MODULE__.Manifest.t(), S3.upload_task_ref() | nil}
66+
5167
# Necessary to start Recorder under a supervisor using `{Recorder, [recorder_opts, gen_server_opts]}`
5268
@doc false
5369
@spec child_spec(list()) :: Supervisor.child_spec()
@@ -126,19 +142,10 @@ defmodule ExWebRTC.Recorder do
126142
@doc """
127143
Finishes the recording for the given tracks and optionally uploads the result files.
128144
129-
Returns the part of the recording manifest that's relevant to the freshly ended tracks.
130-
See `t:ExWebRTC.Recorder.Manifest.t/0` for more info.
131-
132-
If uploads are configured:
133-
* Returns the reference to the upload task that was spawned.
134-
* Will send the `:upload_complete`/`:upload_failed` message with this reference
135-
to the controlling process when the task finishes.
136-
137-
Note that the manifest returned by this function always contains local paths to files.
138-
The updated manifest with `s3://` scheme URLs is sent in the aforementioned message.
145+
See `t:end_tracks_ok_result/0` for the success typing.
139146
"""
140147
@spec end_tracks(recorder(), [MediaStreamTrack.id()]) ::
141-
{:ok, __MODULE__.Manifest.t(), S3.upload_task_ref() | nil} | {:error, :tracks_not_found}
148+
end_tracks_ok_result() | {:error, :tracks_not_found}
142149
def end_tracks(recorder, track_ids) do
143150
GenServer.call(recorder, {:end_tracks, track_ids})
144151
end

0 commit comments

Comments
 (0)