BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-13-2008, 09:47 PM   #1 (permalink)
New Member
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Nextel
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to play radio by URL

Please Login to Remove!

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!

Last edited by Hampshire : 04-13-2008 at 09:48 PM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

15 PCS BLACKBERRY M-S1 BLACKBERRY BOLD BATTERY (BAT-14392-001) BATTERIES
$3.99
15 PCS BLACKBERRY M-S1 BLACKBERRY BOLD BATTERY (BAT-14392-001) BATTERIES pictureRIM ASY-07559-001 PSM05R-050CHW BLACKBERRY TRAVEL CHARGER ADAPTER QUANTITY
$25.0
RIM ASY-07559-001 PSM05R-050CHW BLACKBERRY TRAVEL CHARGER ADAPTER QUANTITY pictureRESEARCH IN MOTION RIM PSM04A-050RIMC 5V BLACKBERRY AC ADAPTER CHARGER
$20.0
RESEARCH IN MOTION RIM PSM04A-050RIMC 5V BLACKBERRY AC ADAPTER CHARGER pictureNew BlackBerry Icon Mouse Pad Mats Mousepad Hot Gift
$10.91
New BlackBerry Icon Mouse Pad Mats Mousepad Hot Gift picture12 cans ZEP Meter Mist mandarian + blackberry + vanilla
$43.99
12 cans ZEP Meter Mist mandarian + blackberry + vanilla picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.