Problem with Manager.createPlayer)

Hello

I want to play a little mp3 noise when I turn on my BB with a background application. So first, I tried this code in a foreground application:

    public void play()      {        //first we need to find the supported content types        String types[] = Manager.getSupportedContentTypes(null);        for (int cnt = types.length - 1; cnt >= 0; --cnt) {            if (types[cnt].equals("audio/mpeg")) {            //this sample demonstrates playing an MP3 file that has been             //added as a resource to the project            try {                //retrieve the MP3 file                Class clazz = getClass();                InputStream is = clazz.getResourceAsStream("/test.mp3");                //create an instance of the player from the InputStream                Player player = Manager.createPlayer(is, "audio/mpeg");                player.realize();                player.prefetch();                //start the player                player.start();                } catch (Exception ex) { System.out.println("ERROR -> "+ex); }             }         }    }

But it does not work! It returns the exception "java.lang.IllegalArgumentException: flow: null". I think that it does not find test.mp3. I put the mp3 file in the same directory the files .java and .jdp.

So, could you tell me what I have to add or delete of this code, listen to this sound (first in a foreground application) test please!

And is it possible to play an mp3 sound with an application at the beginning of the unit?

Thank you in advance!

It is perhaps the issue:

«I put the mp3 file in the same directory files .java and .jdp.»

The MP3 resource must also be added to the project.

Tags: BlackBerry Developers

Similar Questions

  • Problems with Manager.createPlayer)

    Hello

    I'm new in the world of development of BB... I'm doing a simple application that retrieves a file from a URL .wav and it plays, but the process is stuck on Manager.createPlayer (URL).

    I ran the application using the debugger and when it comes to this line he says 'source not found', here's a snippet of what I'm trying to do:

    public class MyPlayer implements PlayerListener, passable
    {

    Player;

    (I call this my main application thread and start it)

    {} public void start()
    Thread t = new Thread (this);
    t.Start ();
    }

    void run() {}
    try {}
                       
    String url = "http://java.sun.com/products/java-media/mma/media/test-wav.wav";

    Create an instance of player
                 Player = Manager.createPlayer (url); (it gets stuck in this line and the IDE shows a source not found)
    player.addPlayerListener (this);

    make the player
    Player.Realize ();
    Player.prefetch ();
    Player.Start ();
    }
    {} catch (Throwable t)
    reset (); This is a method of myself
    }
    }

    }

    The funny thing is that I tried the same code with a MIDlet and it works well in Nokia and Sony Ericsson simulators, but Blackberry is locked. I'm missing something here?

    I use Eclipse IDE, BlackBerry JDE component Pack Version: 4.5.0.16 and the Simulator Curve BlackBerry 8300 that come with the JDE.

    I also tried the application in a BlackBerry Pearl Simulator, with the same results

    Any advice will be highly appreciated = (...)

    I found the solution, the problem was that my emulator had no access to the internet, when he tried to connect to the URL and get the .wav file it so never found the source.

    I downloaded Blackberry email and MDS services Simulator package, which allows the internet connection for the simulators, and it worked!

    I could connect to the URL and play the .wav

  • Problem with managed server by pointing to a different JDK

    Hello

    My Adminserver is pointed to JDK 1.7 which is shown in the start, but my managed servers point to a different 1.6_43. We are running Java version mismatch problem while deploying our application created with jdk 1.7 on these managed servers. How can I change the version of my managed server?

    Thank you

    Sam

    Hi Sam,

    You usually only have to change it in two places.

    DOMAIN_HOME/bin/setDomainEnv.sh and MW_HOME/wlserver_12.1/common/bin/commEnv.sh

    See the examples below.

    If you are on Linux, you can address it quickly. For example:

    cd /u01/app/oracle/product/fmw
    find . -type f -exec sed -i "s/\/u01\/app\/oracle\/product\/jdk1.6.0_39/\/u01\/app\/oracle\/product\/java_current/g" {} \;
    

    It's a good idea to do a softlink to your installation of Java, so you will not have this problem in the future. If you are on Windows, you can use a symlink.

    Linux example:

    ln -s /u01/app/oracle/product/jdk1.7.0_25 /u01/app/oracle/product/java_current
    

    Example of Windows:

    mklink /d D:\oracle\product\java_current D:\oracle\product\jrockit-jdk1.6.0_26-R28.1.4-4.0.1
    

    setDomainEnv.sh

    /u01/app/oracle/domains/eksudv/bin/setDomainEnv.sh
    
    if [ "${JAVA_VENDOR}" = "Oracle" ] ; then
            JAVA_HOME="${BEA_JAVA_HOME}"
            export JAVA_HOME
    else
            if [ "${JAVA_VENDOR}" = "Sun" ] ; then
                    JAVA_HOME="${SUN_JAVA_HOME}"
                    export JAVA_HOME
            else
                    JAVA_VENDOR="Sun"
                    export JAVA_VENDOR
                    JAVA_HOME="/u01/app/oracle/product/java_current"
                    export JAVA_HOME
            fi
    fi
    

    commEnv.sh

    /u01/app/oracle/product/fmw/wlserver_12.1/common/bin/commEnv.sh
    
    # Reset JAVA_HOME, JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
    # and JAVA_VENDOR are pre-defined.
    if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
      # Set up JAVA HOME
      JAVA_HOME="/u01/app/oracle/product/java_current"
      # Set up JAVA VENDOR, possible values are
      #Oracle, HP, IBM, Sun ...
      JAVA_VENDOR=Sun
      # PRODUCTION_MODE, default to the development mode
      PRODUCTION_MODE=""
    fi
    

    What about Peter

    http://theheat.dk

  • find: problems with managed partners entities (associations 1-1)

    Hello

    Let's say we have this association:

    FCalendar <>- contest

    This association is bidirectional and one by one.

    In addition, imagine that the database already contains a contest with the id 'Comp111 '.

    I created:

    Model contest = new Competition ("Comp111");
    ....
    CAL FCalendar = new FCalendar("Cal111"); "Cal111" is the identifier of this calendar object.
    cal.setCompetition (comp);
    comp.setFCalendar (cal);

    EntityManager em = getEntityManager(); This album Gets an EntityManager correctly.

    em.getTransaction () .begin ();

    EM. Persist (FCalendar.class, cal);

    Here I cal as a managed entity. He points to the model of the unmanaged object.
    When validation occurs, the FCalendar DB table will add a line for this calendar
    with the value "Cal111" as a primary key and the 'Comp111' for the competition column
    (i.e., the foreign key of the competition associated with cal will refer to the "Comp111" competition
    Since the DB contains a contest with the same id as cal.getCompetition ())

    FCalendar caldb = em.find (FCalendar.class, cal.getFCalendarId ());

    Now I get a managed entity caldb pointing MANAGED an OTHER ENTITY (let's call it "compdb") which
    a as the identifier "Comp111". This is the case, since the default recovery model is EAGER to associations 1-1.

    Contest compdb = caldb.getCompetition ();

    As I have explained, compdb is a managed entity.

    compdb.setFCalendar (caldb);

    In this way, I get the bidirectionnalite of the association. The competition management compdb now points to the caldb calendar.

    em.getTransaction () .commit ();

    The DB is synchronized. The contest of the comics with the id "Comp111" should point to the "Cal111" calendar and vice versa.

    However, this is not the case. I get a competition since the database with the id "Comp111", its associated calendar is null (as if I have not defined any calendar).

    What do miss me here? I would be very grateful if anyone can provide clues.

    (BTW, I did this test with JPA and toplink persistence provider)

    Joe

    Published by: user632543 on June 2, 2013 04:50

    Published by: user632543 on June 2, 2013 04:51

    Not quite what I wanted. When you call persist, you place the entity instance in the collection of the MA of managed entities. She's going to get synchronized with the database when the transaction is committed or empty.

    In your code:

    EM. Persist (CAL);
    FCalendar caldb = em.find (FCalendar.class, cal.getFCalendarId ());

    will result in cal == caldb. They are the same instance. Nothing to get in the database until the transaction either emptied or committed, so the referenced competition can be the instance empty just created instead of a reading from the database. It's a bad idea to create empty instances of objects that exist in the database when you use a find or getReference instead. And you must set the backpointer competing.

    Best regards
    Chris

  • Problem with management of SerialElement

    Hello

    I have a SerialElement and it contains two ad_video and then normal_video premiera MediaElement. So I'm first display ad and video using it. Now my problem is I want to disable controls such as play, pause etc. When ad say first MediaElement to plays, and then also detect if it is finished to start to display all orders for the second normal video. Are events that I can use for this or any other approach.

    Thank you and best regards,

    Amit

    We have here an example:

    http://opensource.Adobe.com/svn/opensource/OSMF/trunk/apps/samples/framework/ExamplePlayer /org/osmf/examples/seeking/UnseekableProxyElement.as

    You would wrap the first VideoElement in this UnseekableProxyElement before adding it to the SerialElement.

  • ClassCastException on Manager.createPlayer problem with DataSource

    I run the code BufferedPlayback (JDE 4.7.0) example loading a local file (LimitedRateStreamingSource to the source of data):

    final LimitedRateStreamingSource source = new LimitedRateStreamingSource("file:///store/home/user/test/test.wav");
    source.setContentType("audio/x-wav");
    final Player player = Manager.createPlayer(source);
    

    but when I create the player a ClassCastException is thrown.
    Search with google I found this method performs a cast to CommonDataSource, and this leads to the exception (http://discussion.forum.nokia.com/forum/showthread.php?t=113902).

    I can't figure out how to solve this problem... someone has any advice?

    LimitedRateStreamingSource in this example expects a HTTP URL.  When you use it with a file:/// URL a FileConnection is returned by the Connector.open call, which triggers a ClassCastException.

    You will need to modify the example to use a FileConnection instead of a ContentConnection.

  • I had some problems with my pc, since then when I close Firefox it would not reopen unless I go to Task Manager and end the process for FF.

    I had some problems with my pc, since then when I close Firefox it would not reopen unless I go to Task Manager and end the process for FF. I uninstalled FF and re-installed and no change.
    Walt

    I have a same problem.

  • Problems with the Power Manager 1.51 new T60 has

    I've updated Power manager version 1.51 has and I have problems with the gauge of Power Manager in the task bar. Life remaining battery is not updated once more. Is there any chance I can find an earlier version of the software that worked perfectly before? Or there is a method to solve the problem?

    Sincerely,

    Nikita Septucha


  • Problems with Windows Update! ("some settings are managed by your system administrator"?)

    I seem to have problems with my windows update. Last week when I checked to see if updates were needed that I was unable to view them because he said that "some settings are managed by your system administrator" who won't let me change the settings and the display of updates. It's my own personal computer so I am the administrator. However, this week update windows begins to function normally because there was an update available and I managed to download it, but a few days later, the windows on the screen update returned to say that "some settings are managed by your system administrator. I did a scan for spyware/adware/virus recently and I had only a low risk of adware that was detected and deleted without modification with windows update. This problem started right after that I got a warranty of software installed by Dell, I don't know if what they did could cause the problem. The system I use is Windows Vista Home Premium Service Pack 2. Any help would be greatly appreciated!

    You can see the effects of a hijackware infection. That being said...

    McAfee applications (and Norton) are known for not not upgrade (or uninstalling) itself.

    1. run this triple McAfee fix: http://service.mcafee.com/FAQDocument.aspx?id=TS100507

    2. After completing step 3 of triple correction, manually & repeatedly update your McAfee application until you get a prompt 'no more updates'.

    3. open Internet Explorer (only) to http://support.microsoft.com/kb/971058 & run it in DEFAULT and modes difficulty then AGGRESSIVE. [1]

    4. restart & test by...

    How will I know if my computer is up to date? :
    http://Windows.Microsoft.com/en-us/Windows-Vista/how-can-I-tell-if-my-computer-is-up-to-date

    ~~~~~~~~~~~~~~~~~~~~~~~~
    [1] full Disclosure: the difficulty operating in AGGRESSIVE mode will remove your update history but not the list of installed updates.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Problems with Aero and Desktop Manager

    All these problems started after I downloaded an upgrade of windows (last year I think). Whenever I started my computer to the taskbar and stuff Aero initiated very well, then after a few seconds the taskbar became white and disable Aero. Now, it is even worse, Windows just to start with the Basic (looking for old windows) theme and even if I try to restart the Desktop Window Manager, it will not work. Yesterday I installed and Nvidia card (the PC came with a built-in video chip only) and I was hoping to get the fix for the problem, but did not *. I also downloaded the Fix Aero tool and nothing. Even the msconfig.exe won't help. What can I do? It frustrates me.

    Hello

    If you have already tried to run the fix in the below gave link, try the steps that are proposed in the given link and check if that helps.

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-Windows-Aero

    Hope that information was useful

  • Problem with touch in a focus Manager

    I searched the threads on this topic but impossible to find a solution.

    Here's the thing: I have a screen, to which I add a custom handler that I add other components such as buttons, textfields, other managers and so on.

    One of the components of this is a focus Manager, I did work as a button, because he was too customized to be a button, with two blocks of text and a bitmap.

    In a trackball device it works fine, when I ride down he's focused and I can select normally, but when I use a camera touch (9550) touchs are ignored.

    I had other problems with Tush, I used a VerticalManager for the front screen and no matter where I hit, the only button I could choose was the last. Then I changed VerticalManager to the Manager and it worked, but the focus Manager I mentioned previously still did not work.

    Any ideas?

    Thanks in advance.

    Kind regards

    Dan

    It seems that the Manager cannot be selected unless there is an active field inside so you need to touch this area.

    So, the solution is to add a new field to the handler, like this:

    add(managerFocusButton = new Field() {
        protected void paint(Graphics graphics) {
        }
        protected void layout(int width, int height) {
            setExtent(width, height);
        }
        public boolean isFocusable() {
            return true;
        }
        protected void drawFocus(Graphics graphics, boolean on) {
        }
    });
    

    And then this kid with the width and height of his Manager.

    The field is not visible and the Manager won't entirely.

    Thank you.

  • Problem with DVD player and get the error code 19 Device Manager

    Original title: TSSTcorp CDDVDW SH - 224DB ATA device

    Windows cannot start this hardware device because its information of configuration (in the registry) is incomplete or damaged. (Code 19)

    How to fix it please Message Please please how to fix it

    Hi Emerald,

    Please contact Microsoft Community. I understand that you have a problem with the CD\DVD drive and get the error code 19 Device Manager. I've surely you will help solve this problem.

    To better understand the issue, I would like to know if you have any recent software or hardware on the computer changes before this problem?

    This problem might have occurred because of these reasons:

    1. Install or uninstall the CD or DVD recording programs.
    2. Uninstall Microsoft Digital Image.

    Try the steps listed here and see if it helps:

    I suggest you try the procedure described in article which will correct corrupted registry entries. Check if it helps.

    Your CD-ROM or DVD drive is not recognized by Windows or other programs
    http://support.Microsoft.com/kb/314060/en-us

    Note: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information on how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    Hope this information helps. Reply to the post with an up-to-date report of the issue so that we can help you further.

  • Problem with disk management.

    To increase the size of drive, I installed win 7 64 bit from a cloned on a WD Green 3 TB hard drive backup.  When I go to disk management I have the following: Disk 0: base / system reserve 1.87 GB NTFS healthy, "C:" 2046,13 GB NTFS healthy, no Boot affected 746,52 GB.

    I could not wish 'C' in the unallocated space.  Is this possible and if so, what is the procedure?

    Thanks for the help

    There is a specific problem with windows that imposes a limit of 2 GB on hard drives. This can be overcome by using a GPT partition table, but then needs a UEFI BIOS in order to boot from it.

  • problem with the windows Task Manager.

    Hello.i uses windows 7 64 bit and I have a problem with my windows task manager.i am still able to use the windows task manager but when it appears, the tab all lack .it s display only a program this running.i hope you can help solve this problem.thank you.

    To regain the tabs and information, double-click on the outside edge of the window.

  • I get a box that says, please verify your billing information. We discovered a problem with your last payment for creative cloud. Go online to manage your account and check your billing account. 19 days remaining. What is c?

    I get a box that says, please verify your billing information. We discovered a problem with your last payment for creative cloud. Go online to manage your account and check your billing account. 19 days remaining. What is c?

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

Maybe you are looking for

  • Questions about the standard wireless keyboard and mouse on a h8 - 1360 t.

    Hi again, I have a h8 - 1360t with the standard wireless keyboard and mouse. 1. where is information on the blue buttons 'connect' keyboard and mouse? 2. the mouse has a power switch - do I really have to close each time, or is there a function of in

  • FSX and Vista Home Premium problems

    How can I get good frame on FSX rates?  As I loaded Vista64 on my computer, I have averaged 3 to 8 FPS!  What don't get me, I tried all kinds of settings and no dice!  Thanks for any help! My computer: AMD Athlon 64 X 2 Dual Core Processor 6000 + 3.1

  • Clock of the printer

    HP Envy 5660 clock is exactly 5 hours ahead of the (correct) (area CDT) computer clock. How can I put it?

  • HP Laserjet 1100 driver missing for Windows 7

    Windows 7 can not find the driver for my printer HP laserjet 1100 on my home network. When I try to go to the HP website to download the driver it says that it is included in Windows 7. I did a Windows Update. I did add a printer in devices and print

  • Message icon missing blackBerry Smartphones

    I have the blackberry curve 8520 and the icon envelope message from the homepage has disappeared. I always get new warning messages, but there is no envelope icon to navigate when you switch on the phone. Any ideas?