Skip to main content

Getting Started with Tunez

πŸ“¦ Installation​

Install Tunez via npm:

npm install tunez

πŸ›  Setup​

First, import TunezProvider, useTunez, and the AudioPlayer component from tunez:

import AudioPlayer , { TunezProvider, useTunez } from 'tunez';

Wrap your app with TunezProvider so you can access the useTunez hook from anywhere:

function MyApp({ children }) {
return (
<TunezProvider>
{children}
</TunezProvider>
);
}

🎡 Using Tunez​

You can now use useTunez to control playback. Here’s a simple example:

import { useTunez, AudioPlayer } from 'tunez';

const track = {
title: 'Sample Track',
src: 'https://example.com/sample.mp3',
author: 'Artist Name',
thumbnail: 'https://example.com/thumbnail.jpg',
};

function PlayerExample() {
const { playTrack } = useTunez();

return (
<div>
<AudioPlayer />
<button onClick={() => playTrack(track)}>
Click to Play
</button>
</div>
);
}

Now you’re ready to integrate Tunez into your project! πŸš€