79750345

Date: 2025-08-29 13:40:09
Score: 1.5
Natty:
Report link

I cannot reproduce your issue. If I setup a project, according to your description it works just fine.

I created a default project Next.js 15 project:

npx create-next-app@latest

Added an MP3 to public/audio/sample.mp3

Replaced the page.tsx with:

"use client";

const playDeleteSound = async () => {
  try {
    const audio = new Audio("/audio/sample.mp3");
    await audio.play();
  } catch (error) {
    console.log("Audio playback error:", error);
  }
};

export default function Home() {
  return (
    <div className="flex items-center justify-center min-h-screen bg-gray-100">
      <button
        onClick={playDeleteSound}
        className="px-6 py-3 rounded-2xl bg-blue-600 text-white text-lg font-semibold shadow-md hover:bg-blue-700 transition"
      >
        ▶ Play Sound
      </button>
    </div>
  );
}

It shows a play button, when I click that, it starts playing the file.

enter image description here

Full project code: https://github.com/Borewit/serve-mp3-with-nextjs

Reasons:
  • Blacklisted phrase (0.5): I cannot
  • Probably link only (1):
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
Posted by: Borewit