Determine if the music plays in another application

Hello

I'm currently porting a game to the BB10 platform iOS. A minor feature supported, we have supported with iOS version is that if the user currently played music through the iPod application, when they launched our game, we have disabled automatically the music in the game to allow to continue to play their music.

I would recreate this feature on BB10 but can't seem to find a reliable way to simply determine if any music evolves into another application. I can't stop everything simply by calling mediacontroller_stop() at the spearhead of our game, which is at least better than to have the external application and our game playing music at the same time, but this is not a solution particularly 'Nice' playing of music and I would improve it if possible, so I was wondering if anyone had any suggestions for how I could do this?

Ah, Yes, with a few game, that I finally got information of the mediacontroller. It seems that if the music is already running when your application starts the mediacontroller sends an event with State MEDIASTATE_PLAYING MEDIACONTROLLER_STATE. By setting up a listener for this event, I was able to catch it and disable our music.

For anyone else trying to solve a similar problem, the relevant code is:

#include 
int main(int argc, char *argv[])
{    /* Set up listener */
    mediacontroller_request_events(0);

    /* Basic application loop */
    while (!exit_application)
    {
        //Request and process all available BPS events
        bps_event_t *event = NULL;

        for(;;)
        {
            if(event)
            {
                if(domain == mediacontroller_get_domain())
                {
                    const int code=bps_event_get_code(event);
                        if(code == MEDIACONTROLLER_STATE)
                        {
                            const media_state_t state=(media_state_t)mediacontroller_event_get_state(event);
                            switch(state)
                            {
                                case MEDIA_STATE_PLAYING:
                                {
                                                /* Disable in-game music */
                                    break;
                                }

                                case MEDIA_STATE_UNRECOGNIZED:
                                case MEDIA_STATE_STOPPED:
                                case MEDIA_STATE_PAUSED:
                                case MEDIA_STATE_TRACK_CHANGE:
                                {
                                    break;
                               }                               }
                    }
                }
        }}

Of course this could also be used to respond to other changes in the State, if necessary also.

Bravo for the people of assistance!

Tags: BlackBerry Developers

Similar Questions

  • How to reset the music plays in the new itunes update

    Got that new iTunes update 12.4 and now I can't find the button I would like to reset the music plays, or even better, to delete a song off the popular 'top 25 most played' playlists

    someone has suggestions it really help me?

    Just spoke with Apple 17/05/16 Support 15: 40 EDT.  According to the technical support, the option "Reset plays" has been removed from the Version 12.4 by design and should not be sent back to this or later versions.  Guess I'll try and find a 3rd party that supports this option.  Thank you APPLE for thinking about your users.

  • Music: How can I transfer all of the music files to another user account

    How can I transfer all of the music files to another user account

    In simple terms, simply copy it to an external drive and then copy them back as the other user.  If files are protected by DRM (Digital Rights Management) as iTunes from Apple or Napster, you will need to know your service music, if the files can be copied.

    "rstoyka" wrote in the new message: * e-mail address is removed from the privacy... *

    How can I transfer all of the music files to another user account

  • Keyboard shortcut to use the color picker in another application

    Hi, I'm new here. My first post.

    I remember there was a shortcut in Ps to use the color picker in another application. For example, choose a color from a web browser. I don't remember the keyboard shortcut. Anyone know it?

    Kind regards

    Leif

    You can choose the eyedropper tool, click on your document open in photoshop, and then hold down the left mouse button while you drag out of photoshop to read the colors.

    Also works when the adobe color picker dialog box open in photoshop.

  • Display of the music playing on the lock screen, even if its does not and the application is closed

    Even if I'm not listening to music and I closed the app, why he has begun to show that if it plays on my lock screen, this also happens intermittently and not all the time.  Also, I noticed on my lock screen when music does not appear I have the music symbol in the lower left corner of the screen and the camera symbol at the bottom right shows that I never noticed before, normally only the symbol of the camera?

    I believe that this is part of the suggested Apps feature. To turn this off, go to settings > general > Handoff & Apps suggested under Apps suggested, turn off installed Apps.

  • The music plays constantly, unknown source?

    Hey havin a problem here. My computer is constantly playing this horribly inflatable music in the background, and I can't turn it off. None of the media players seem to play, and it is not coming out of the web browser. Just sort of, it started when I saw a vid of South Park on the site comedynetwork, thought it was the episode in the first haha but no, he just kept goin'. So I turned off the pc and it began a few hours later, and the music begins to play on its own again.

    It seems that this could be a video game, but the only real game installed on here is Gothic, and seems not have everything installed in the hard disk of the audio files. Please help, this music really sucks.

    This should help you track down this music program comes.
    Click on the speaker icon who has regressed to the clock on your taskbar. Then choose mixer the volume control that arise. Any program that is turning off sound or recently established sound will appear in the mixer. Start at different Applications of inhibition and see when the sound stops. It will be that the sound is coming from.

    Let me know the results.

    Paul

  • How to stop the music played when I open a new tab. This just started to happen.

    When I open a new tab, the music begins to play. It sounds like something Publishers Clearing house could play.
    I didn't add everything add on.

    I found the answer.
    It is only on the new blank tabs. Pages seen playing music.

  • I can't the music playing in my car when I have iPod touch connected via Bluetooth. I get message says: CONNECT to THE WI FI TO PLAY music. Why not play via Bluetooth only?

    Hello..

    I'm playing my iPod touch in my car through Bluetooth. The audio system in my car recognizes the iPod via Bluetooth. but, I can't seem to play the music. I get a message on the iPod that reads to CONNECT to WI - FI TO PLAY MUSIC. There is of course no WIFI signal in my car, just Bluetooth. Why can't the iPod to play through my audio system via the Bluetooth connection? Why he keep insisting that I need to connect to the wi FI? How to play via a Bluetooth connection? The Bluetooth is in the car & on the iPod. It is synchronized to the top.

    Thank you in advance for help.

    Hi, Mishkapatches.

    Please visit Apple support communities.

    It sounds like you may be a subscriber of Apple music and media has not been made available to listen to offline.  I suggest you take a look at the article below.  This will guide you through the process of downloading music music Apple directly on the device so that you can listen to music when not connected to the internet.

    Add music catalog to Apple's music to your library on your iPhone, iPad, iPod touch, Mac or PC

    See you soon

  • The music playing when my phone goes to sleep?

    After updating from my phone to the gingerbread, whenever I put it down about 1 minute later it begins to play the same piece of Cold Play. When I hit the power button to wake up the music stops and there is no request music running? What the hell is happening? does anyone else have this problem? My phone is not rooted, has never been and I did a factory zero right after upgrade to start again.

    Well, I think I thought about it myself. Gingerbread chose the song some how as a default notice for my email. So evertime I'm e-mail started the same song. YES! My Droid X is not possesed.

  • Cannot open the Lightroom Catalog because another application already is open.

    I hard a message that another application has the open catalog, but I have no idea what's open. Any ideas on how to understand what program it was open?

    When Lightroom has an open catalog it creates a temporary file next to the catalog file, which has the same name with an extension .lock. By default, the files are located as shown in the attached screenshot.

    If Lightroom is not normally closed the .lock file will remain in place and prevent Lightroom opening of the catalog said.

    With Lightroom closed go to the subfolder of Lightroom, and if there is a file with the name of .lock extension remove the file, and then try and open Lightroom.

  • Sansa Clip + 8 GB show all the music, play or delete on PC

    Yesterday, I plugged the drive to my pc to remove some songs and add some new ones. Everything was going well until I went to add a song that is on my computer for a long time. When I wanted to copy into the folder music from Sansa, he said that I couldn't copy it and then did my drive started to act up.

    Now when I load the folder music, I get a bunch of icons that look like the icon 'internal memory' before, it shows my music. But then it loads up to the letter T, and even then, it skips the letter S and shows only 3 songs of the letter T. It won't let me play anything out if the folder no more. If I click on any song in this folder to read it, I get the following error message...

    Can not play. Try playing something else. File format can be unspoorted, file extension may be incorrect or the file may be corrupt.

    I can't delete songs or even these icons because he told me that my drive is not connected. I tried changing the settings to MSC and MTP and it does not help. And neither the factory resets to zero. I think it's the * beep * windows media player. I think that it it screws to the top when he tries to synchronize my drive w / it.

    My player works fine in my car. I have a stereo that has the USB port, so I can connect my player up to it. No problem.

    I really don't want to reformat, but if I have too... No one knows why this happens? Is there a solution without reformatting?

    happenn wrote:

    I don't have us WMP to transfer songs, I do it manually. It's just that whenver I connect my player, WMP has to get involved. There certainly must be a setting where I can turn this function OFF

    Use the MSC Mode, not the PSG. It's what gets involved WMP.

    But, that being said... your computer cannot see files in 1 mode, at the same time, so after re - format switch the player in MSC mode (settings > system settings > USB Mode), then re - load your files on the drive. Otherwise, it can get really confusing. And do not use the Autodetect setting. Which defaults to MTP mode if it detects that WMP is on the system.

  • Why my iPad back to the homescreen when on another application how can I solve this problem

    WWhen I go to Google or something, why it goes back to the home screen, and how do I fix.

    I'm doing my food and hygiene but it keeps going back to the home screen and I have to start everything again very frustrating

    Thanks, hope someone can help me solve this problem

    Double click on the home button and drag the apps are shut up. Then hold down the sleep/wake and the "home" button until the Apple logo appears. Also, take a look at the following article. If an application you have installed unexpectedly closes, unresponsive or won't open - Apple Support

    -AJ

  • How to integrate an audio to a Muse image file so that the music plays only when you click on the image?

    Hello! I'm looking for a way to incorporate an audio file (mp3 or quicktime) into a still image in my Muse site. Ideally, the audio would play only when you click the image, so that each image can contain a separate audio file. So important is that the audio file is not visible on the site (so soundcloud, youtube and vimeo doesn't work here). Is there a way to do this? Thank you, AR

    Check out this edition of the month of 123Muse (www.123Muse.com). This is audio and video by Muse.

  • Hi, I am on the Plan of photographer with CC in Photoshop and Lightroom CC.  What is the cost to add another application (InDesign)?

    Thank you very much

    You can go for a unique application for design or get full CC. Please refer to https://creative.adobe.com/plans

    The app two cannot be contributed.

    Concerning

    Baudier

  • Call the indesign.executeScript () to another application

    Hello I am saying to Indesign to run a script from a script with the command indesign.executeScript () photoshop.

    The question I have, is that I don't know how to specify the script target. He is looking for a full path or just a script name in the scripts Panel?

    the following code works;

    var script = "alert ('testing')"
    indesign.executeScript (script)

    can someone send an example please. I use CS5 and jsx files.

    Thank you! I had no idea! Its in the same place in the CS5 ESTK. So you want to use the 'indesign.executeScriptFile ()' method to answer the previous question, this woks with specifying a path to your script, it seems that the method you were trying to use "indesign.executeScript ()" waiting for you to spend a real script, i.e. the text of your javascript.

    I hope this helps!

    And yet thanks to Mark for your wisdom, for us novices show a thing or two

Maybe you are looking for

  • HP Pro book: updated Base system device

    I recently bought a HP Probook and I upgraded windows to earn 8.1. However, after installing the new windows and the required updates, I couldn't update the Base system device. I tried several time troubleshooting it and search for drivers online but

  • Satellite L20-100 can be started from a USB external hard drive?

    I recently bought Toshiba Satellite L20-100 and I wonder if:1. is it possible to boot this machine from a disk usb external drive?2. it is possible to attach another internal hard drive? Assuming that the two answers above are 'no', how can we solve

  • Problems after Marshmallow inLenovo k3 update notice

    "There was a problem starting Instagram. Please uninstall and reinstall Instagram, and then try again." This error I face after update my K3 Marshmallow note. Even after uninstalling, then reinstalling, nothing changes. This error I face with many ap

  • Upgrade hp laptop hard drive to a 500 GB to 1 TB

    I changed on my hard drive for a1TB blue of the 500 GB WD make a very bad virus, I used the recovery disks that I did when I bought the computer. I have tried three times now to load the recovery disk when I reboot full realized and when it restarts

  • How do I get the acceleration and GPS at the same time?

    Goal: Get an acceleration and GPS at the same time Current situation: I can get acceleration or GPS. When I try to get the data, the code ends. Mini Code If (bps_event_get_domain (event) == sensor_get_domain()) {}handle_acceleration_data();}If (bps_e