JavaFX mp3 music player 🎵

  Рет қаралды 60,251

Bro Code

Bro Code

Күн бұрын

JavaFX mp3 music player program project tutorial
#javafx #music #mp3
You may need to add this VM argument to run configurations:
--add-modules javafx.controls,javafx.media
music credits 🎼
====================================
song: Block Party | artist: Bad Snacks
/ @badsnacks
song: Level Up | artist: Quincas Moreira
/ @quincasmoreira
song: Twelve Speed | artist: Slynk
/ @slynk
====================================

Пікірлер: 71
@BroCodez
@BroCodez 3 жыл бұрын
// *************************** // JavaFX mp3 music player // *************************** package application; import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.ResourceBundle; import java.util.Timer; import java.util.TimerTask; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.control.Slider; import javafx.scene.layout.Pane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.util.Duration; public class Controller implements Initializable{ @FXML private Pane pane; @FXML private Label songLabel; @FXML private Button playButton, pauseButton, resetButton, previousButton, nextButton; @FXML private ComboBox speedBox; @FXML private Slider volumeSlider; @FXML private ProgressBar songProgressBar; private Media media; private MediaPlayer mediaPlayer; private File directory; private File[] files; private ArrayList songs; private int songNumber; private int[] speeds = {25, 50, 75, 100, 125, 150, 175, 200}; private Timer timer; private TimerTask task; private boolean running; @Override public void initialize(URL arg0, ResourceBundle arg1) { songs = new ArrayList(); directory = new File("music"); files = directory.listFiles(); if(files != null) { for(File file : files) { songs.add(file); } } media = new Media(songs.get(songNumber).toURI().toString()); mediaPlayer = new MediaPlayer(media); songLabel.setText(songs.get(songNumber).getName()); for(int i = 0; i < speeds.length; i++) { speedBox.getItems().add(Integer.toString(speeds[i])+"%"); } speedBox.setOnAction(this::changeSpeed); volumeSlider.valueProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue package application; import java.io.IOException; import javafx.application.Application; import javafx.application.Platform; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.stage.Stage; import javafx.stage.WindowEvent; import javafx.scene.Parent; import javafx.scene.Scene; public class Main extends Application { @Override public void start(Stage stage) throws IOException { Parent root = FXMLLoader.load(getClass().getResource("Scene.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); stage.setOnCloseRequest(new EventHandler() { @Override public void handle(WindowEvent arg0) { Platform.exit(); System.exit(0); } }); } public static void main(String[] args) { launch(args); } }
@benderbg
@benderbg 11 ай бұрын
I finally got to the end of this amazing course! What a journey its been! Thanks a lot Bro for taking the time and creating this amazing series. So this entire playlist with its 155 lessons as of 9/2023 is 28h 42min long. I started the course on 8/27/2023 and finished everything on 9/27/2023 which is exactly one month digesting on average 1h of video per day. In reality it usually took between 3-5 hours for 1h of video with taking notes (Word document has 316 pages in the end), doing some debugging and tinkering in between but it was all worth it. Congratulations to all who made it to the end and good luck in your future programming endeavours. For me its time to get some SQL knowledge next. P.S. Too bad Bro's C# course is only 4h long, hope he gets time to add more content to that one as well. It would also be nice to release a few videos with CRUD operations in Java.
@chadelz
@chadelz 21 күн бұрын
MS Learn C# learning pathway was the best source of learning C# for me personally.
@jefferyjohnson2612
@jefferyjohnson2612 3 жыл бұрын
Dude, this thing is amazing! I love it. I couldn't get it to run at first, but kept tinkering with it and now I'm grooving on AC/DC. Great job man!
@filippoguerrini1240
@filippoguerrini1240 3 жыл бұрын
How did u do that?
@lequangnghi194
@lequangnghi194 Жыл бұрын
I'm glad I'm finally here, the end of this Java Tutorials My next goals is your CSS, HTML and JAVASCRIPT series From the bottom of my heart, thanks Bro! Bro Code is da best!
@pepperceptive
@pepperceptive Жыл бұрын
im currently on number 65 on the JAVA tutorials. if you dont mind me asking, how confident do you feel with JAVA after finishing these? would you say you feel educated enough to work in a job that requires JAVA programing? thanks.
@saarza9991
@saarza9991 2 ай бұрын
​@@pepperceptive sorry but this is just basic Java. Core Java consists of so much more
@gentworm2377
@gentworm2377 3 жыл бұрын
My watch later playlist is getting too big!
@micleh
@micleh 2 жыл бұрын
Thanks a lot for the awesome project. 6:15 - If in Scenebuilder you go under View -> Show Sample Controller Skeleton, you could copy that skeleton into your Controller class and you'd be done, right? There would be no need to write the method headers yourself.
@khanhtu7525
@khanhtu7525 Жыл бұрын
That is very helpful, thanks a lot.
@lequangnghi194
@lequangnghi194 Жыл бұрын
Wow, this is extremely helpful Thanks!
@ademolaakinyemi3743
@ademolaakinyemi3743 3 жыл бұрын
Please can you do more of this using IntelliJ, some of us cant deal with the redundancy and complexity of eclipse, I've had many issues along the line while doing this on IntelliJ?
@user-sb3vh6by7e
@user-sb3vh6by7e 3 жыл бұрын
Interesting, as always. Keep up the great work!
@kimevar
@kimevar 3 жыл бұрын
Hey i have a question, i merged two mp3 files with java code.( merged two FileInputStream s into a SequenceInputStream and then then wrote a file with FileOutputStream ) and is there a way to speed it that mp3 file?
@werq27
@werq27 11 ай бұрын
Great job, Bro!!! Thank you very much!
@anmolmandhan9913
@anmolmandhan9913 2 жыл бұрын
When I write Private Media media; Private MediaPlayer mediaPlayer; And making object of media than I find exception how can i resolve this please help
@032_anjaliprabha9
@032_anjaliprabha9 2 жыл бұрын
facing the same issue.. did you resolve it?
@abeer5252
@abeer5252 2 жыл бұрын
Try adding this VM argument --add-modules javafx.controls,javafx.media
@darkstormd9934
@darkstormd9934 Жыл бұрын
@@abeer5252 Where should I add this argument? I have the same issue
@urielmalka729
@urielmalka729 3 жыл бұрын
Hi thank you about your videos 😍 ‎‏if you can make video about data to server it is will be a great.
@kenkei.mwaniki
@kenkei.mwaniki 3 ай бұрын
hello Bro Could you post a video on how to create an executable file for JavaFX programs. I'm running it and it says sth about VM arguements
@kingoffun5569
@kingoffun5569 2 жыл бұрын
i have lost of errors in this, so please give me git link
@lequangnghi194
@lequangnghi194 Жыл бұрын
Hi Bro, can I ask? Why the .jar from exporting a JavaFX project doesn't working Nothing happens when I double click on the .jar file
@rachelgreen9754
@rachelgreen9754 Жыл бұрын
Please make videos on topics like JSP, servelet, applets in java
@oguzhantopaloglu9442
@oguzhantopaloglu9442 3 жыл бұрын
This is so impressive wow
@myryu4138
@myryu4138 6 ай бұрын
i can't import Media class. you know why?? ㅜㅜ
@s.saransh5187
@s.saransh5187 3 жыл бұрын
After writing this code I'm getting an error Could not find or load main class application.Main
@abhishekmaurya9503
@abhishekmaurya9503 2 жыл бұрын
Same here. How did you solved bro?
@AnonimosExeretis
@AnonimosExeretis 10 ай бұрын
Any Gradle dependencies for this?
@petarvukcevic6889
@petarvukcevic6889 2 жыл бұрын
When i enter fullscreen its size stays the same. How to make it responsive? Reply asap please.
@rau149
@rau149 2 жыл бұрын
Cheers to you and your playlist!
@adszization
@adszization 3 жыл бұрын
what is your github page link??
@comptegmail273
@comptegmail273 3 жыл бұрын
hey sir i'm workign with another method ; instead of using "filechooser" I'm displaying the mp3 files of my directory in listview and I'm trying to play and stuff. for now playing , volume slider and the timeline slider work. Only the pause and stop seem to not working. When I select an item from my listview; @FXML public void playVideo(ActionEvent event){ //PLAY THE 1ST SONG chansons = listV.getSelectionModel().getSelectedItem(); path = chansons.toURI(); test = new Media(Paths.get(path).toUri().toString()); finale = new MediaPlayer(test); finale.play(); } I tried to add this because for example when I want to play the next song , I automatically need to stop the last one so the new one plays so I added this testing, if the user has selected another song to play , ... // //RECHECKING THE SELECT ITEM // File chansons1 = listV.getSelectionModel().getSelectedItem(); // URI path2 = chansons.toURI(); // System.out.println("C"); // // //WHILE THE SELECTED ITEM IS NOT LIKE THE OLD SELECTED ONE // //WE WE STOP PLAYING THE OLD AND PLAY THE NEW ONE // // while (!path.equals(path2)) { // System.out.println("D"); // finale.stop(); // Media test2 = new Media(Paths.get(path).toUri().toString()); // MediaPlayer finale2 = new MediaPlayer(test2); // finale2.play(); // } Your feedback is heavily appreciated!!
@melodypahakesse1923
@melodypahakesse1923 2 жыл бұрын
I come across another video by livingstone code that does what you are trying to do
@pbgolloucs
@pbgolloucs Жыл бұрын
man, could you do a Java Swing MP3 Music Player please
@hippiestafarii
@hippiestafarii 2 жыл бұрын
I have done all series ... Thanks Bro !!!
@umairyasin5951
@umairyasin5951 Жыл бұрын
Is this complete series?
@kakashi99908
@kakashi99908 2 жыл бұрын
Man I give up this is just completely broken with the latest versions
@mahmoudebada4025
@mahmoudebada4025 11 ай бұрын
Really awesome 😎
@sug_madic7683
@sug_madic7683 3 жыл бұрын
Bro A discord channel bro
@Aryan-de9jw
@Aryan-de9jw 11 ай бұрын
what can't you make with java bro😊
@filippoguerrini1240
@filippoguerrini1240 3 жыл бұрын
How should i set VM arguments to run the project?
@darkstormd9934
@darkstormd9934 Жыл бұрын
Have you found the solution? I cant import Media for some reason...
@beebahzz1368
@beebahzz1368 3 жыл бұрын
Bro Can You at least do some example with NeatBeans...
@hippiestafarii
@hippiestafarii 2 жыл бұрын
It's not about the IDE ...
@dev688
@dev688 3 жыл бұрын
LOL! Nice Intro
@pradyumnahegde5091
@pradyumnahegde5091 3 жыл бұрын
"couldn't able move on: com.sun.media.jfxmedia.MediaException: Could not create player!" is what the exception says, I almost did everything possible to resolve the issue.
@trungdu9354
@trungdu9354 2 жыл бұрын
$ java --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml,javafx.media,javafx.web application.Main you need add module javafx.media when compiling in VM w/ javac -d . command
@trungdu9354
@trungdu9354 2 жыл бұрын
oh and if you do thru terminal you also need that long path to open it up
@jellyfish6042
@jellyfish6042 2 жыл бұрын
@@trungdu9354 can you please write separately what I should to add to VM arguments? Thanks in advance
@ataiabdiev2355
@ataiabdiev2355 3 жыл бұрын
hi i need your help how can i text you?
@adityarajsrivastava6580
@adityarajsrivastava6580 3 жыл бұрын
I wanted a help, is there any other way of adding an ActionListener in Java without using "this" keyword.
@CharleyCheno
@CharleyCheno 3 жыл бұрын
yes
@BroCodez
@BroCodez 3 жыл бұрын
It depends. You might be able to add an anonymous ActionListener or even a lambda expression
@CharleyCheno
@CharleyCheno 3 жыл бұрын
ok
@adityarajsrivastava6580
@adityarajsrivastava6580 3 жыл бұрын
@@BroCodez Oh, I never thought of that, thank you very much!!
@anmolmandhan9913
@anmolmandhan9913 2 жыл бұрын
@@adityarajsrivastava6580 when I write private MediaPlayer and making object so I find exception plz help
@Padovanienzo
@Padovanienzo 2 жыл бұрын
does anyone know why my Intellij cant resolve symbol 'Media'?
@masaalrefae3283
@masaalrefae3283 2 жыл бұрын
do you solve it ?
@darkstormd9934
@darkstormd9934 Жыл бұрын
I have the same problem. Did you find the solution?
@moaazsuliman7584
@moaazsuliman7584 Жыл бұрын
Please I want this code.❤
@JuanCarlos-qd1wk
@JuanCarlos-qd1wk Жыл бұрын
Eres el mejor que buen video
@mezgebubirhane8657
@mezgebubirhane8657 3 жыл бұрын
Thanks Bro
@jcorrales07
@jcorrales07 2 жыл бұрын
THANK U BROOOOO
@phoenixnetworks5896
@phoenixnetworks5896 Жыл бұрын
Amazing bro 🤩
@alipro1284
@alipro1284 Жыл бұрын
a lot of thanks to you for this fucking course
@ctluwua7695
@ctluwua7695 3 жыл бұрын
YOu know you saved me
@Loay_Ghreeb
@Loay_Ghreeb Жыл бұрын
songNumber = (songNumber + 1 ) % songs.size();
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 64 М.
JavaFX scenes + drawing stuff 🌄
15:18
Bro Code
Рет қаралды 78 М.
отомстил?
00:56
История одного вокалиста
Рет қаралды 4,5 МЛН
Bend The Impossible Bar Win $1,000
00:57
Stokes Twins
Рет қаралды 47 МЛН
So Cute 🥰
00:17
dednahype
Рет қаралды 49 МЛН
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 17 МЛН
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,7 МЛН
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 1,1 МЛН
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 399 М.
Demystifying the C++ Compiler!
12:52
Low Level Game Dev
Рет қаралды 10 М.
Make your project UNREMIXABLE !
10:51
SL Smart Mind
Рет қаралды 215 М.
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,5 МЛН
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 402 М.
Which phone do you have?
0:33
Adhemz
Рет қаралды 4,7 МЛН
🤯Huawei УНИЗИЛА Apple?🔥
1:00
Не шарю!
Рет қаралды 338 М.