Giter VIP home page Giter VIP logo

audius.js's Introduction

audius.js

Audius.js offers a dead simple Javascript client for interacting with the Audius protocol.

This package is early and experimental. You may experience bugs and frequent changes.

Audius.js currently only works in Node environments. It will not work in a browser.

Under the hood, audius.js leverages Audius Libs, a much lower level client, to interact with the network.

Functionality

Audius.js currently supports streaming tracks and retrieving track metadata.

Audius.js is fully documented.

To stream a track, Audius.js provides an HLS manifest encoded in a data-URL. This URL should be consumable by clients that can stream HLS.

Installation

npm install @audius/audius.js

Usage

const Audius = require('@audius/audius.js')

// Create a new instance of the Audius client
const audius = new Audius({
  /* Give this client a descriptive ID describing this application. */
  analyticsId: 'audius_discord_bot'
})

// Return metadata for some track
const trackId = '12345'
try {
  const metadata = await audius.getTrackMetadata(trackId)
  console.log(metadata.title)
} catch (err) {
  ...
}

// Return a streamable URL for some track,
// do something fun with it.
try {
  const url = await audius.getAudioStreamURL(trackId)

  // Pass it off to a Discord client - fun!
  discordVoiceConnection.play(url)
} catch (err) {
  ...
}

Notes

TrackIds

Many of the methods accept trackIds. TrackIds may be found by stripping off the trailing digits from an Audius track URL: e.g. "https://audius.co/lido/life-of-peder-part-one-11786" => 11786

Developing

Linting

Audius.js uses ESLint to lint as pre-commit hook. ESLint is configured with both StandardJS and Prettier settings.

It's highly recommended to turn on auto-fixes on save in your editor of choice. In VSCode, you can install the ESLint Extension, and then add the following code to your settings.json:

    "editor.codeActionsOnSave": {
        "source.fixAll": true
    },

Commands

// Compile the lib in watch mode
npm run start
// Compile the lib once.
npm run build
// Compile docs for the lib.
npm run docs

audius.js's People

Contributors

piazzatron avatar raymondjacobson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.