pub trait VideoService<I, O> {
type GetPlaylistBody: WriteBody<O> + 'static;
type GetPlaylistInBoundsBody: WriteBody<O> + 'static;
Show 19 methods
// Required methods
fn get(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Video, Error>;
fn batch_get(
&self,
auth_: BearerToken,
request: GetVideosRequest,
) -> Result<GetVideosResponse, Error>;
fn search(
&self,
auth_: BearerToken,
request: SearchVideosRequest,
) -> Result<SearchVideosResponse, Error>;
fn create(
&self,
auth_: BearerToken,
request: CreateVideoRequest,
) -> Result<Video, Error>;
fn update_metadata(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: UpdateVideoMetadataRequest,
) -> Result<Video, Error>;
fn update_ingest_status(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: UpdateIngestStatus,
) -> Result<(), Error>;
fn get_ingest_status(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<DetailedIngestStatus, Error>;
fn batch_get_ingest_status(
&self,
auth_: BearerToken,
video_rids: BTreeSet<VideoRid>,
) -> Result<BTreeMap<VideoRid, DetailedIngestStatus>, Error>;
fn get_enriched_ingest_status(
&self,
auth_: BearerToken,
request: GetEnrichedVideoIngestStatusRequest,
) -> Result<Option<EnrichedVideoIngestStatus>, Error>;
fn archive(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<(), Error>;
fn unarchive(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<(), Error>;
fn get_playlist(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Self::GetPlaylistBody, Error>;
fn get_segment_summaries(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Vec<SegmentSummary>, Error>;
fn get_playlist_in_bounds(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetPlaylistInBoundsRequest,
) -> Result<Self::GetPlaylistInBoundsBody, Error>;
fn get_segment_summaries_in_bounds(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetSegmentSummariesInBoundsRequest,
) -> Result<Vec<SegmentSummary>, Error>;
fn get_file_summaries(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetFileSummariesRequest,
) -> Result<GetFileSummariesResponse, Error>;
fn generate_whip_stream(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<GenerateWhipStreamResponse, Error>;
fn generate_whep_stream(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Option<GenerateWhepStreamResponse>, Error>;
fn upload_segment_from_media_mtx(
&self,
auth_: BearerToken,
stream_path: String,
file_path: String,
duration: String,
content_length: SafeLong,
body: I,
) -> Result<(), Error>;
}Expand description
The video service manages videos and video metadata.
Required Associated Types§
Sourcetype GetPlaylistBody: WriteBody<O> + 'static
type GetPlaylistBody: WriteBody<O> + 'static
The body type returned by the get_playlist method.
Sourcetype GetPlaylistInBoundsBody: WriteBody<O> + 'static
type GetPlaylistInBoundsBody: WriteBody<O> + 'static
The body type returned by the get_playlist_in_bounds method.
Required Methods§
Sourcefn get(&self, auth_: BearerToken, video_rid: VideoRid) -> Result<Video, Error>
fn get(&self, auth_: BearerToken, video_rid: VideoRid) -> Result<Video, Error>
Returns video metadata associated with a video rid.
Sourcefn batch_get(
&self,
auth_: BearerToken,
request: GetVideosRequest,
) -> Result<GetVideosResponse, Error>
fn batch_get( &self, auth_: BearerToken, request: GetVideosRequest, ) -> Result<GetVideosResponse, Error>
Returns video metadata about each video given a set of video rids.
Sourcefn search(
&self,
auth_: BearerToken,
request: SearchVideosRequest,
) -> Result<SearchVideosResponse, Error>
fn search( &self, auth_: BearerToken, request: SearchVideosRequest, ) -> Result<SearchVideosResponse, Error>
Returns metadata about videos that match a given query.
Sourcefn create(
&self,
auth_: BearerToken,
request: CreateVideoRequest,
) -> Result<Video, Error>
fn create( &self, auth_: BearerToken, request: CreateVideoRequest, ) -> Result<Video, Error>
Creates and persists a video entity with the given metadata.
Sourcefn update_metadata(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: UpdateVideoMetadataRequest,
) -> Result<Video, Error>
fn update_metadata( &self, auth_: BearerToken, video_rid: VideoRid, request: UpdateVideoMetadataRequest, ) -> Result<Video, Error>
Updates the metadata for a video associated with the given video rid.
fn update_ingest_status( &self, auth_: BearerToken, video_rid: VideoRid, request: UpdateIngestStatus, ) -> Result<(), Error>
fn get_ingest_status( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<DetailedIngestStatus, Error>
fn batch_get_ingest_status( &self, auth_: BearerToken, video_rids: BTreeSet<VideoRid>, ) -> Result<BTreeMap<VideoRid, DetailedIngestStatus>, Error>
fn get_enriched_ingest_status( &self, auth_: BearerToken, request: GetEnrichedVideoIngestStatusRequest, ) -> Result<Option<EnrichedVideoIngestStatus>, Error>
Sourcefn archive(&self, auth_: BearerToken, video_rid: VideoRid) -> Result<(), Error>
fn archive(&self, auth_: BearerToken, video_rid: VideoRid) -> Result<(), Error>
Archives a video, which excludes it from search and hides it from being publicly visible, but does not permanently delete it. Archived videos can be unarchived.
Sourcefn unarchive(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<(), Error>
fn unarchive( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<(), Error>
Unarchives a previously archived video.
Sourcefn get_playlist(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Self::GetPlaylistBody, Error>
fn get_playlist( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<Self::GetPlaylistBody, Error>
Generates an HLS playlist for a video with the given video rid to enable playback. The HLS playlist will contain links to all of the segments in the video in sequential order.
Sourcefn get_segment_summaries(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Vec<SegmentSummary>, Error>
fn get_segment_summaries( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<Vec<SegmentSummary>, Error>
Returns the min and max absolute and media timestamps for each segment in a video. To be used during frame-timestamp mapping.
Sourcefn get_playlist_in_bounds(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetPlaylistInBoundsRequest,
) -> Result<Self::GetPlaylistInBoundsBody, Error>
fn get_playlist_in_bounds( &self, auth_: BearerToken, video_rid: VideoRid, request: GetPlaylistInBoundsRequest, ) -> Result<Self::GetPlaylistInBoundsBody, Error>
Generates an HLS playlist for a video with the given video rid to enable playback within an optional set of bounds. The HLS playlist will contain links to all of the segments in the video that overlap with the given bounds. playlist will be limited to the given bounds.
Sourcefn get_segment_summaries_in_bounds(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetSegmentSummariesInBoundsRequest,
) -> Result<Vec<SegmentSummary>, Error>
fn get_segment_summaries_in_bounds( &self, auth_: BearerToken, video_rid: VideoRid, request: GetSegmentSummariesInBoundsRequest, ) -> Result<Vec<SegmentSummary>, Error>
Returns the min and max absolute and media timestamps for each segment in a video that overlap with an optional set of bounds.
Sourcefn get_file_summaries(
&self,
auth_: BearerToken,
video_rid: VideoRid,
request: GetFileSummariesRequest,
) -> Result<GetFileSummariesResponse, Error>
fn get_file_summaries( &self, auth_: BearerToken, video_rid: VideoRid, request: GetFileSummariesRequest, ) -> Result<GetFileSummariesResponse, Error>
Returns the min and max absolute timestamps from non-archived video files associated with a given video that overlap with an optional set of bounds. The files on the edges of the bounds will be truncated to segments that are inside or overlap with the bounds.
Sourcefn generate_whip_stream(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<GenerateWhipStreamResponse, Error>
fn generate_whip_stream( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<GenerateWhipStreamResponse, Error>
Generates a stream ID scoped to a video and returns a WHIP URL with a MediaMTX JWT and ICE servers. Enforces write permission on the video.
Sourcefn generate_whep_stream(
&self,
auth_: BearerToken,
video_rid: VideoRid,
) -> Result<Option<GenerateWhepStreamResponse>, Error>
fn generate_whep_stream( &self, auth_: BearerToken, video_rid: VideoRid, ) -> Result<Option<GenerateWhepStreamResponse>, Error>
Returns WHEP URL, ICE servers, and token for playing back the active stream. Returns empty if there is no active stream. Enforces read permission on the video.
Sourcefn upload_segment_from_media_mtx(
&self,
auth_: BearerToken,
stream_path: String,
file_path: String,
duration: String,
content_length: SafeLong,
body: I,
) -> Result<(), Error>
fn upload_segment_from_media_mtx( &self, auth_: BearerToken, stream_path: String, file_path: String, duration: String, content_length: SafeLong, body: I, ) -> Result<(), Error>
MediaMTX segment upload endpoint. Receives video segments from MediaMTX hooks. Validates JWT and logs session. Future: create video segments from uploaded files.