View Source Kino.Audio (Kino v0.12.3)

A kino for rendering a binary audio.

examples

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)

Link to this section Summary

Functions

Creates a new kino displaying the given binary audio.

Link to this section Types

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

Link to this section 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

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