Turns out I simply had the wrong jar file. Question Closed.
Observing a radio stream java
-
22-07-2023 - |
Question
So i'm trying it make it stream the radio, which it does fine, But only for about 10 seconds. After that i've been told it is supposed to send a notification to anyone observing it. I either am not recieving this message, or I did something wrong, which is a lot more likely.
public class RadioListener implements Observer
{
public static void main(String[] args)
{
RadioPlayer player = new RadioPlayer();
try
{
URL url = new URL("http://stream.xmission.com:8000/kcpw");
RadioListener r = new RadioListener();
player.addObserver(r);
player.playRadioStream(url);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void update(Observable arg0, Object arg1)
{
System.out.println("message: " + arg1);
}
}
This plays the radio for about 10 seconds then just terminates. Not sure why =/
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow