So you're adding rain sounds to your client? Kinda strange as there is no rain in the clients of this section.
If perhaps you made a full weather system, that would be quite interesting.
|
So my first question was "Why not just go to rainymood.com? It doesent stop after 30 minutes."
My answer is simply this: It didn't take very long at all. For the people who may actually like Rainy Mood this could be pretty cool.
Features v0.1:
-Starts out with a 30 seocnd clip of thunder
-Plays for 30 minutes exactly
-Helps relax you in times of need
This is will eventually be worked on and added to make better.
Plans for v0.2:
-Rain NEVER stops
-Toggles for rain/thunder
-Possibly some type of Gui Player
Start off by downloading the MP3 files and placing the 2 .mp3 files in your caches root directory
MP3 Download:
http://dl.dropbox.com/u/45027916/Rainy%20Mood.zip
Now in your client files create a new .java file and name it
RainyMood.java
Code:import java.io.BufferedInputStream; import java.io.FileInputStream; import javazoom.jl.player.Player; import sign.signlink; public class RainyMood{ private String filename; private Player player; private static String RainyMood = signlink.findcachedir() + "RainyMood.mp3"; private static String RainyMoodThunder = signlink.findcachedir() + "RainyMoodThunder.mp3"; public RainyMood(String filename) { this.filename = filename; } public void close() { if (player != null) { player.close(); } } public void play() { try { FileInputStream fis = new FileInputStream(filename); BufferedInputStream bis = new BufferedInputStream(fis); player = new Player(bis); } catch (Exception e) { System.out.println("Problem playing file " + filename); System.out.println(e); } new Thread() { @Override public void run() { try { player.play(); } catch (Exception e) { System.out.println(e); } } }.start(); } public static void main(String[] args) { playRain(); playThunder(); } public static void playRain() { String RainyMoodMP3Dir = RainyMood; RainyMood RainyMoodMP3 = new RainyMood(RainyMoodMP3Dir); RainyMoodMP3.play(); } public static void playThunder() { String RainyMoodThunderMP3Dir = RainyMoodThunder; RainyMood RainyMoodThunderMP3 = new RainyMood(RainyMoodThunderMP3Dir); RainyMoodThunderMP3.play(); } }
Save and close
Open client.java
Search:
The line afterCode:public static void main
addCode:try {
Save and close.Code:RainyMood.main(args);
Make sure you have the Player library in you're client or it wont compile
Use Google to figure out how to import librarys if youre not using and IDE
Download Player.jar:
http://dl.dropbox.com/u/45027916/Player.jar
Please don't flame
So you're adding rain sounds to your client? Kinda strange as there is no rain in the clients of this section.
If perhaps you made a full weather system, that would be quite interesting.
hmm, i did place player.jar in the i should.Code:.\RainyMood.java:3: error: package javazoom.jl.player does not exist import javazoom.jl.player.Player; ^ .\RainyMood.java:16: error: cannot find symbol player.close(); ^ symbol: method close() location: variable player of type Player .\RainyMood.java:23: error: constructor Player in class Player cannot be applied to given types; player = new Player(bis); ^ required: no arguments found: BufferedInputStream reason: actual and formal argument lists differ in length .\RainyMood.java:33: error: cannot find symbol try { player.play(); } ^ symbol: method play() location: variable player of type Player Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors Trykk en tast for å fortsette...
oh wow you're so dumb, here's an easier way
no need for cache edits or anything, and more importantly, it's just 1 line of code
Code:openURL("http://rainymood.com/");
I was looking at the site, that's music URL http://174.36.223.28/audio1295/SeparatedPart2.mp3
They Randomize the IP between 173.193.205.68 and 174.36.223.28.
With JMF you could use the link to play as stream and write on disk while streaming, so next time that you reproduce it will stream from file till where file data is available.
Loop the music is the easier thing ever, I also think that you don't even have to reproduce the whole music before start again, that way you would save some memory space.
That's a better way to do this, because I really think that no one would like to download 30MB of one music to listen to rain, even because it's 1/3 of some worst cache size.
Using your library:
Hint:Code:public static void main(String[] args) throws IOException, JavaLayerException { String link = "http://174.36.223.28/audio1295/SeparatedPart2.mp3"; URLConnection con = new URL(link).openConnection(); InputStream in = con.getInputStream(); Player player = new Player(in); player.play(); }
btw this Player class is really poor even the AdvancedPlayer is garbage.Code:player.setPlayBackListener(new PlaybackListener() { @Override public void playbackFinished(PlaybackEvent evt) { /** Do Something here to start again **/ } });
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |