Skip to main content

media_register

Function media_register 

Source
pub async fn media_register(
    profile_id: ProfileId,
    bucket: BucketId,
    key: String,
    server: State<'_, MediaServerHandle>,
    store: State<'_, ProfileStoreHandle>,
) -> Result<MediaRegisterResponse, AppError>
Expand description

Mint a signed token for the given S3 object and return a loopback URL.

The returned URL can be set as the src of a <video> or <audio> element. The server validates the token, enforces expiry, and streams the S3 object with byte-range support.

§Parameters

  • profile_id — profile whose credentials service the stream.
  • bucket / key — S3 coordinates.
  • server — managed MediaServerHandle (port + registry).
  • store — profile store used to resolve the bucket region.

§Token TTL

Default: 3 600 seconds (1 hour). Tokens also expire when the session ends via revoke_session.

§Errors

Returns AppError::NotFound when profile_id does not exist. Returns AppError::Auth when the profile has not been validated.