Search code examples
blackberryjava-memedia-player

Play audio file on BlackBerry Storm


I want to play an mp4 audio file from a URL. This code works for a non-touch device, but I am facing a problem playing on the Storm.

Player player = javax.microedition.media.Manager.createPlayer(url);//_source
System.out.println("******************LoginScreen.player" + LoginScreen.player);
playerListener = new MediaPlayerListener();
LoginScreen.player.addPlayerListener(playerListener);
LoginScreen.player.realize();
LoginScreen.player.prefetch();
LoginScreen.player.start();

Solution

  • As you are using a HTTP location, you should specify an interface.

    For wifi: ;interface=wifi

    Thus your url should be like so:

    String url= "http://yoursite.com/file.m4a;deviceside=true;interface=wifi";
    Player player = javax.microedition.media.Manager.createPlayer(url);//_source