-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaOnline.java
More file actions
38 lines (30 loc) · 928 Bytes
/
MediaOnline.java
File metadata and controls
38 lines (30 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class MediaOnline{
private static String link;
public MediaOnline(String arg) {
this.link = arg;
}
public static void play() {
String song = link;
Player mp3player = null;
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new URL(song).openStream());
mp3player = new Player(in);
mp3player.play();
} catch (MalformedURLException ex) {
} catch (IOException e) {
} catch (JavaLayerException e) {
} catch (NullPointerException ex) {
}
}
public static void main(String args[]) {
MediaOnline mo = new MediaOnline(args[0]);
mo.play();
}
}