Hello,
I'd like to start a radio streaming on the BlackBerry MediaPlayer by a URL streaming source.
The problem is I can't get the MediaPlayer loaded.
Has anyone an idea how to handle this?
I followed the code from the BlackBerry Developers Guide but I can't get it started. Here is my code:
Code:
private void doPlayMusic(){
String url = "http://radio.level-1.org.uk:9106/listen.pls";
MediaManager manager = new MediaManager();
MediaPlayer player = new MediaPlayer();
try {
Object media = manager.createMedia(url);
player.setMedia(media);
} catch (IOException ioe) {
System.out.println("Error: requested content was not downloaded.");
} catch (MediaException me) {
System.out.println("Error: " + me.getCode());
}
// start media player
add((Field)player.getUI());
// play content
if(player.getState() == MediaPlayer.REALIZED) {
try {
player.start();
} catch(MediaException me) {
System.out.println("Error occurred during media playback: " +
me.getCode() + me.getMessage());
}
}
} Thanks for any suggestions!