Bunnyx.VideoLibrary (Bunnyx v0.3.0)

Copy Markdown View Source

Stream video libraries. A video library is a container for videos that handles encoding, storage, and delivery through bunny.net's Stream platform.

Uses the main API client created with Bunnyx.new/1.

Usage

client = Bunnyx.new(api_key: "sk-...")

{:ok, lib} = Bunnyx.VideoLibrary.create(client, name: "my-library")
{:ok, lib} = Bunnyx.VideoLibrary.get(client, lib.id)
{:ok, page} = Bunnyx.VideoLibrary.list(client)
{:ok, lib} = Bunnyx.VideoLibrary.update(client, lib.id, enable_transcribing: true)
{:ok, nil} = Bunnyx.VideoLibrary.delete(client, lib.id)

Summary

Functions

Adds a hostname to the video library's allowed referrer list.

Adds a hostname to the video library's blocked referrer list.

Uploads a watermark image for a video library.

Creates a video library with the given attributes.

Deletes a video library.

Returns DRM statistics for a video library.

Fetches a video library by ID.

Lists available languages for transcription and captions.

Lists video libraries.

Removes a hostname from the video library's allowed referrer list.

Removes a hostname from the video library's blocked referrer list.

Removes the watermark from a video library.

Resets the API key for a specific video library.

Resets the read-only API key for a specific video library.

Returns transcription statistics for a video library.

Updates a video library.

Types

t()

@type t() :: %Bunnyx.VideoLibrary{
  allow_direct_play: boolean() | nil,
  allowed_referrers: [String.t()] | nil,
  api_key: String.t() | nil,
  blocked_referrers: [String.t()] | nil,
  date_created: String.t() | nil,
  date_modified: String.t() | nil,
  enable_drm: boolean() | nil,
  enable_mp4_fallback: boolean() | nil,
  enable_transcribing: boolean() | nil,
  enabled_resolutions: String.t() | nil,
  has_watermark: boolean() | nil,
  id: pos_integer() | nil,
  keep_original_files: boolean() | nil,
  name: String.t() | nil,
  player_key_color: String.t() | nil,
  player_token_authentication_enabled: boolean() | nil,
  pull_zone_id: integer() | nil,
  read_only_api_key: String.t() | nil,
  replication_regions: [String.t()] | nil,
  storage_usage: integer() | nil,
  storage_zone_id: integer() | nil,
  traffic_usage: integer() | nil,
  ui_language: String.t() | nil,
  video_count: integer() | nil,
  webhook_url: String.t() | nil
}

Functions

add_allowed_referrer(client, id, hostname)

@spec add_allowed_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Adds a hostname to the video library's allowed referrer list.

add_blocked_referrer(client, id, hostname)

@spec add_blocked_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Adds a hostname to the video library's blocked referrer list.

add_watermark(client, id, image_data)

@spec add_watermark(Bunnyx.t() | keyword(), pos_integer(), binary()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Uploads a watermark image for a video library.

create(client, attrs)

@spec create(Bunnyx.t() | keyword(), Bunnyx.Params.attrs()) ::
  {:ok, t()} | {:error, Bunnyx.Error.t()}

Creates a video library with the given attributes.

delete(client, id)

@spec delete(Bunnyx.t() | keyword(), pos_integer()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Deletes a video library.

drm_statistics(client, id, opts \\ [])

@spec drm_statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) ::
  {:ok, map()} | {:error, Bunnyx.Error.t()}

Returns DRM statistics for a video library.

Options

  • :date_from — start date (ISO 8601 string)
  • :date_to — end date (ISO 8601 string)

get(client, id)

@spec get(Bunnyx.t() | keyword(), pos_integer()) ::
  {:ok, t()} | {:error, Bunnyx.Error.t()}

Fetches a video library by ID.

languages(client)

@spec languages(Bunnyx.t() | keyword()) :: {:ok, list()} | {:error, Bunnyx.Error.t()}

Lists available languages for transcription and captions.

list(client, opts \\ [])

@spec list(
  Bunnyx.t() | keyword(),
  keyword()
) ::
  {:ok,
   %{
     items: [t()],
     current_page: integer(),
     total_items: integer(),
     has_more_items: boolean()
   }}
  | {:error, Bunnyx.Error.t()}

Lists video libraries.

Options

  • :page — page number
  • :per_page — items per page
  • :search — search term

remove_allowed_referrer(client, id, hostname)

@spec remove_allowed_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Removes a hostname from the video library's allowed referrer list.

remove_blocked_referrer(client, id, hostname)

@spec remove_blocked_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Removes a hostname from the video library's blocked referrer list.

remove_watermark(client, id)

@spec remove_watermark(Bunnyx.t() | keyword(), pos_integer()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Removes the watermark from a video library.

reset_api_key(client, id)

@spec reset_api_key(Bunnyx.t() | keyword(), pos_integer()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Resets the API key for a specific video library.

reset_read_only_api_key(client, id)

@spec reset_read_only_api_key(Bunnyx.t() | keyword(), pos_integer()) ::
  {:ok, nil} | {:error, Bunnyx.Error.t()}

Resets the read-only API key for a specific video library.

transcribing_statistics(client, id, opts \\ [])

@spec transcribing_statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) ::
  {:ok, map()} | {:error, Bunnyx.Error.t()}

Returns transcription statistics for a video library.

Options

  • :date_from — start date (ISO 8601 string)
  • :date_to — end date (ISO 8601 string)

update(client, id, attrs)

@spec update(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) ::
  {:ok, t()} | {:error, Bunnyx.Error.t()}

Updates a video library.