我使用JLayer来实现这个收音机:
public class RadioImplement {
public static void main(String[] args) {
try {
//works fine
// playRadioStream ( "http://kantipur-stream.softnep.com:7248" );
//hitsfm works fine
// playRadioStream ( "http://webstream.hitsfm.com.np:5098/" );
playRadioStream("http://108.166.174.131:8002/;stream.mp3"); //doesnt work
//playRadioStream(" https://radio.itechnepal.com/kanchanjunghafm/stream"); doesn't work either says 403 forbidden
} catch (IOException e) {
e.printStackTrace();
} catch (JavaLayerException e) {
e.printStackTrace();
}
}
private static void playRadioStream(String spec) throws IOException, JavaLayerException {
// Connection
URLConnection urlConnection = new URL(spec).openConnection();
urlConnection.connect();
// Playing
Player player = new Player(urlConnection.getInputStream());
player.play();
}
}
IP地址网址和网络流不起作用。在网络流中,它使用https://
并表示它被禁止,并且IP地址会出现一些错误。我该怎么做才能解决这个问题?