1.0.3 β€’ Published 1 month ago

react-playify v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

npm downloads npm npm downloads npm downloads

First of all, I want to thank you all for choosing React Playify. React Playify is a lightweight and user-friendly media player built with React. Whether you're a developer looking to integrate a simple yet powerful media player into your React projects or a user seeking a hassle-free way to enjoy your music collection, React Playify offers a seamless solution. You can reach me dhanushsaji1@gmail.com

Features

  • Lightweight
  • Small size
  • Accessible

Install

npm i react-playify

Quick Start

Don't forget to pass the audio array and the useState variables along with their respective set functions. Also, avoid setting the value to true initially. This is because the audio element can't be played until there is a DOM interaction by the user, as per the browser's rule, and we can't override this. If it seems confusing 😰😰, don't worry, it's simple.

❌ ❌ ❌ Don't set the value initially true ❌ ❌ ❌

  const [isPlaying, setIsPlaying] = useState(true)

βœ… βœ… βœ…Instead do this βœ… βœ… βœ…

  const [isPlaying, setIsPlaying] = useState(false)
import { useState } from 'react'
import {Player} from 'react-playify'

function App() {
  const [isPlaying, setisPlaying] = useState(false)
  let musicArray = [
    {title:'Song 1',subtitle:'Song sub',audio:'song1.mp3',image:'image1.jpg'},
    {title:'Song 2',subtitle:'Song sub',audio:'song2.mp3',image:'image2.jpg'},
  ]
  return (
    <>
    <Player audio={musicArray} isPlaying={isPlaying} setisPlaying={setisPlaying} />
    </>
  )
}

export default App

Configuration

Below is all the available options you can pass to the component. Options without defaults are required. We will add more customization soon.!πŸš€πŸš€πŸš€

NameTypeDefaultDescription
themestringnullBy default it will be white theme. Other themes are glass, #141414 black, #3fa9ff blue, #862BD0 purple
audioarraynullSimply pass an array of object like this [{title:'',subtitle:'',audio:'',image:''}] . Apart from audio key you can pass value for other keys
isPlayingbooleanfalseThis is a Boolean value. Pass the first parameter of useState.
setisPlayingfunctionnullThis function changes the Boolean value of isPlaying. Pass the second parameter of useState

Made with ❀

1.0.3

1 month ago

1.0.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago