View Source Kino.Audio (Kino v0.13.2)

A kino for rendering a binary audio.

Examples

content = File.read!("/path/to/audio.wav")
Kino.Audio.new(content, :wav)

content = File.read!("/path/to/audio.wav")
Kino.Audio.new(content, :wav, autoplay: true, loop: true)

Summary

Functions

Creates a new kino displaying the given binary audio.

Types

@type common_audio_type() :: :wav | :mp3 | :mpeg | :ogg
@type mime_type() :: binary()
@type t() :: Kino.JS.Live.t()

Functions

Link to this function

new(content, type, opts \\ [])

View Source
@spec new(binary(), common_audio_type() | mime_type(), keyword()) :: t()

Creates a new kino displaying the given binary audio.

The given type be either :wav, :mp3/:mpeg, :ogg or a string with audio MIME type.

Options

  • :autoplay - whether the audio should start playing as soon as it is rendered. Defaults to false

  • :loop - whether the audio should loop. Defaults to false

  • :muted - whether the audio should be muted. Defaults to false