onamkrverma / okv-music

A progressive music app made with JavaScript using React JS and YouTube Api
https://okv-music.netlify.app/
Mozilla Public License 2.0
4 stars 6 forks source link
music-player music-streaming music-streaming-application reactjs youtube-api

Okv Music

Screenshots

okv music

Demo video

https://github.com/onamkrverma/okv-music/assets/106578262/86e5d3c1-25fd-42e9-96e8-8660537a31fa

Demo Link

Features

Upcoming features to be add

Don't forget to :star: the repo

Technology used

Backend

Note:

Getting Started with Vite React App

installation and setup instructions

  1. installation: npm install
  2. In the project directory, you can run: npm run dev

Runs the app in the development mode.\ Open http://localhost:5173 to view it in your browser. The page will reload when you make changes.

Sample code for backend to get audio url with youtube id

const express = require("express");
const app = express();
const ytdl = require("ytdl-core");

app.get("/song/:id", async (req, res) => {
  try {
    let info = await ytdl.getInfo(req.params.id);
    let audioFormatHigh = ytdl.chooseFormat(info.formats, {
      quality: "highest",
      filter: "audioonly",
    });
    let audioFormatLow = ytdl.chooseFormat(info.formats, {
      quality: "lowest",
      filter: "audioonly",
    });
    res.status(200).json({
      audioFormatHigh: audioFormatHigh.url,
      audioFormatLow: audioFormatLow.url,
    });
  } catch (err) {
    // console.error(error);
    if (err instanceof Error)
      res.status(500).send(`internal server error "${err.message}"`);
  }

Queries

If you have any query or suggestion, feel free to create an issue or submit feedback here