How to Play Music Using Java (Simple)

preview_player
Показать описание
How to Play Music Using Java (Simple)

To play music using Java, we simply need to create an AudioInputStream and create a clip object. We can then pass the AudioInputStream into the clip object and then tell the clip to play the music. Think of this like picking up a CD, opening a CD player, placing the CD into the CD player and pressing play to play the music. A possible dated example but might help understand what is going on.

This tutorial just covers how to play audio from a specified filepath. This tutorial doesn't cover how to loop audio, stop, pause and more.

Thanks for watching this simple tutorial on how to play music using Java.

How to Play Music Using Java (Simple)
Рекомендации по теме
Комментарии
Автор

Awesome music choice! I definetely looked at that horse hahaha

panagiotissfyrakis
Автор

Wow, thanks! This is my first Java video!❤

BrothersGamingNP
Автор

Hi, I followed the instructions exactly, my audio file is also wav, but every time I compile, it always gives the result: File of unsupported format.
I'm sure the path to my audio file is correct:(

minhtri
Автор

What if you ran the java program only from the command line?
I don't suppose a window will be able to popup?

BrennerEraFan
Автор

is there a way for it to keep playing it without doing the 'OK' button thing? cuz like i want music to play in the simple snake game background. any help please

smburhan
Автор

Im making a code to play a song like this but with a lyrics (using thread) do u know how to clear the first line of the song so the second line song come out (to looks neat)

DEAN-dbpq
Автор

is there a video tutorial that a time dictates for the music to be played?

JhunCarreon-utzb
Автор

Hello thanks for this video, it worked for me. But when I run the program, it will silence for 2 second and i can hear sound like "blup" before playing the music, is wav size affect? And how to play mp3?

heri
Автор

Any help with: Package javax.sound.sampled in both module musicplayer and module java.desktop

anthonykunovic
Автор

Ok, but how do you to work in the final jar file. in netbean is easy but in the final jar file is another business.

michael_fsanchez
Автор

keeps saying file not found despite the file being right in my directory

Overseer
Автор

resources folder: i am there for a Reason.

curus
Автор

Are you griffpatch?! I swear your voice is exactly like griffpatch.

ILikeTC
join shbcf.ru