New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

decent-audio-player

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decent-audio-player

Decent UX Components

latest
Source
npmnpm
Version
1.0.6
Version published
Weekly downloads
14
600%
Maintainers
1
Weekly downloads
 
Created
Source

Decent UX Components

Decent's UX Components allows you to easily create your own music player, minting site, or music marketplace with Decent infrastructure.

This library works alongside the Decent minting studio allows for DAOs and individuals to run their own decentralized record labels. Arbitrary music NFTs across a wide variety of contract implementations are supported.

Main components:

  • <AudioPlayer />
    • play / pause button.
  • <PersistentPlayer />
    • full play bar.

Quickstart

  • Add package:
yarn add decent-audio-player

⏯️ decent-audio-player 🎧

2 options:

  • <AudioPlayer /> - single track controls.
  • <PersistentPlayer /> - full-width playbar with playlists.

DECENT_AUDIO_PLAYER

Usage

  • Add Providers:
import { useReducer } from "react";
import {
  DispatchPlayerContext,
  PlayerContext,
  playerInitialState,
  playerReducer,
} from "decent-audio-player";

const App = ({ Component, pageProps }: AppProps) => {
  const [state, dispatch] = useReducer(playerReducer, playerInitialState);
  return (
    <PlayerContext.Provider value={state}>
      <DispatchPlayerContext.Provider value={dispatch}>
        <Component {...pageProps} />
      </DispatchPlayerContext.Provider>
    </PlayerContext.Provider>
  );
};
  • Render a simple Audio Player:
import { AudioPlayer } from "decent-audio-player";

export const Page = () => (
  <AudioPlayer
    size={56}
    audioSrc="https://nftstorage.link/ipfs/QmWNaSdhXq2WdusiBcVC2Ju5A1JJySRDVNrQMEBGcaazvC"
    callbackAfterPlay={console.log}
    active
  />
);
  • Render a full Persistent Player:
import { AudioPlayer } from "decent-audio-player";

const PLAYLIST = [
  {
    songUrl:
      "https://nftstorage.link/ipfs/bafybeihxtxizfgtp5nazudkuc6dvtru2rykyklsse7t5r3rquydirgunxy/SHINY_7.wav",
    project: "shiny",
    artist: "kat dahlia",
    website: "https://github.com/decentxyz",
    image:
      "https://nftstorage.link/ipfs/QmVJBGbMXHNyBe62ruPByK5MG6KdbZkSGPiBMfpqRQ6qP2",
  },
  {
    songUrl:
      "https://nftstorage.link/ipfs/bafybeid3su3rqfwj7ydk52coz3xinku5vc7uu557t7rdkxx5dswcbxolda",
    project: "rugburn by sad alex",
    artist: "sad alex & chillpill",
    website: "https://github.com/decentxyz",
    image:
      "https://nftstorage.link/ipfs/bafybeif55mfehhzipicowg7fpdvdmgulwk6jgz2pbbxwuxjt7pmr7swlvu",
  },
];

export const Page = () => {
  return <PersistentPlayer playlist={PLAYLIST} />;
};

Props

  • <AudioPlayer />

    • size - size of Audio Player.
    • audioSrc - src of audio.
    • callbackAfterPlay - function to call after track begins playing.
    • active - flag for pre-released tracks to be unplayable / disabled.
  • <PersistentPlayer />

    • playlist - Array of Songs Song[].

Song

export type Song = {
  songUrl: string;
  project: string;
  artist?: string;
  website?: string;
  image: string;
};

FAQs

Package last updated on 16 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts