0.0.6 • Published 6 years ago

@radiowave/audino v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Description

Audino.js is a audio library built for native OPUS, MP3, OGA, and AAC streaming. It relies on the Web Audio API to reliably stream audio across all platforms. This library was developed for the Radiowave.io platform.

Build Status Coverage Status

Features

  • Cross platform support
  • Supports OPUS, OGA, MP3, AAC
  • No outside dependencies needed
  • Small in size (6kb)

Installation

npm install @radiowave/audino --save

Example Usage

import { Audino } from '@radiowave/audino'

const play = async () => {
  const player = new Audino()
  await player.loadStream({
    url: 'http://url.com/stream.mp3',
    type: 'mp3'
  })
  await player.play()
}

(async () => {
  await play()
})()

Interfaces

IAudino

PropertyTypeDescriptionIs Read Only
volumeNumberThe current audio volume. Float from 0.0 to 1.0.false
srcStringThe current audio source.true
emitterIEmitterThe event emitter service.true
play() => PromiseBegin playback.
pause() => PromisePause playback.
loadStreams(streams: IStreamDefinitionIStreamDefinition[], priority?: string[]) => PromiseLoad streams. Streams will be sorted by type corresponding to order in priority provided.

IStreamDefinition

PropertyTypeDescriptionIs Read Only
urlStringThe url of the stream to load.false
typeStringThe format of stream. (mp3, aac, oga, opus, ...etc)false
mediaType?StringThe full type including codec where applicable.false

IEmitter

PropertyTypeDescription
$on(hookName: string, fn: (...args) => any) => () => voidSubscribe the provided callback function (fn) to the specified hook. Returns a function to unsubscribe.
$emit(hookName: string, ...args) => PromiseEmit an event to all callback functions for the specified hook.
$offAll(hookName: string) => voidRemove all subscriptions for the specified hook.
0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago