×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    20

    Control native music player

    Sorry for posting this again but I think some people who only care about Symbian C++ and don't go to the Qt area might be able to help me so I just reposted here.

    I need a way to Play/Pause, forward and rewind the native music player in Symbian as I am creating a music player control app. To do this I have determined that I will either somehow need to communicate with the native player or simulate one the media buttons being pressed. On the communication front I have found http://www.developer.nokia.com/Commu...te_Control_API but this doesn't seem to work on newer phones, by the way I am targeting Symbian^3. Trying to simulate the buttons have managed to simulate normal buttons using this type of thing http://www.developer.nokia.com/Commu...ymbian_C%2B%2B, this though unfortunately it seems does not support media keys. Lastly though I have found a working way to listen for these keys through http://www.developer.nokia.com/Commu...ing_media_keys but I cannot figure out how to modify it to simulate these keys being pressed rather than listen for them being pressed.

    To try and modify it I have tried using remconcoreapicontroller.

    mediakeycontroller.h:

    #ifndef MEDIAKEYSOBSERVER_H
    #define MEDIAKEYSOBSERVER_H

    #include <remconinterfaceselector.h>
    #include <remconcoreapicontroller.h>
    #include <remconcoreapicontrollerobserver.h>

    class MediaKeysObserver : public MRemConCoreApiControllerObserver
    {
    public:
    MediaKeysObserver(QObject *parent = 0);
    virtual ~MediaKeysObserver();

    private:
    CRemConInterfaceSelector *interfaceSelector;
    CRemConCoreApiTarget *coreTarget;
    CRemConCoreApiController *coreController;
    };

    #endif // MEDIAKEYSOBSERVER_H

    mediakeycontroller.cpp:

    #include "mediakeysobserver.h"

    MediaKeysObserver::MediaKeysObserver(QObject *parent) : QObject(parent)
    {
    interfaceSelector = CRemConInterfaceSelector::NewL();
    coreController = CRemConCoreApiController::NewL(*interfaceSelector, *this);
    interfaceSelector->OpenTargetL();
    TRequestStatus aStatus;
    TUint aNumRemotes;
    coreController->PausePlayFunction(*aStatus, *aNumRemotes, ERemConCoreApiButtonClick);
    }

    MediaKeysObserver::~MediaKeysObserver()
    {
    delete interfaceSelector;
    }

    This compiles fine but crashes my thread when I try coreController->PausePlayFunction(*aStatus, *aNumRemotes, ERemConCoreApiButtonClick) which results in these types of errors:

    Thread has crashed: Thread 0x971 has panicked. Category: RemConIfSel; Reason: 6
    Thread has crashed: Thread 0x972 has panicked. Category: RemConIfSel; Reason: 6
    Thread has crashed: Thread 0x973 has panicked. Category: RemConIfSel; Reason: 6

    Only the thread UIDs differ every time. Do you have any idea what I am doing wrong or what else I can try to achieve my goal?

    Thanks in advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Control native music player

    from : http://library.developer.nokia.com/i...E857109ED.html the panic is explained as

    "ERemConIfSelNoControllerSession 6

    OpenControllerL has not successfully been called before using an API which expects a controller session to have been created. " though would not really know why this happens.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    20

    Re: Control native music player

    Thanks, I forgot to change OpenTargetL() to OpenControllerL and it compiles now but I have a new problem, I get a reaction but I also get another (3) crash(es):

    [Qt Message] QEventDispatcherSymbian:rocessEvents(): Caught Symbian stray signal
    Thread has crashed: Thread 0x105c has panicked. Category: QEventDispatcher; Reason: 0
    Thread has crashed: Thread 0x105d has panicked. Category: QEventDispatcher; Reason: 0
    Thread has crashed: Thread 0x105e has panicked. Category: QEventDispatcher; Reason: 0
    Last edited by Gerhman.dc; 2012-10-30 at 12:04. Reason: forgot to call function

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Control native music player

    Quote Originally Posted by Gerhman.dc View Post
    Thanks, I forgot to change OpenTargetL() to OpenControllerL and it compiles now but I have a new problem, I get a reaction but I also get another (3) crash(es):

    Thread has crashed: Thread 0x105c has panicked. Category: QEventDispatcher; Reason: 0
    Thread has crashed: Thread 0x105d has panicked. Category: QEventDispatcher; Reason: 0
    Thread has crashed: Thread 0x105e has panicked. Category: QEventDispatcher; Reason: 0
    I suppose, now you should ask that udner the Qt forums, since its Qt-related issue really. Anyway, I never seen that, so would not have any ready made answers for the problem.

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    20

    Re: Control native music player

    Thanks again but I got it working by simply adding:

    User::WaitForRequest(aStatus);

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Control native music player

    Quote Originally Posted by Gerhman.dc View Post
    Thanks again but I got it working by simply adding:

    User::WaitForRequest(aStatus);
    ok, strange error then, basically with symbia you should get Stray signal panic for the mistake..

  7. #7
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Control native music player

    Rather than creating a new thread, I want to ask a question related to the same functions:

    How to get 'CRemConCoreApiController::FastForward' / 'CRemConCoreApiController::Rewind' functions to work?

    I tried it with 'ERemConCoreApiButtonClick' / 'ERemConCoreApiButtonPress' and they both don't work, knowing that all other functions work normally and as expected.

    My best regards, and many thanks in advance.
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  8. #8
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,086

    Re: Control native music player

    Does the request(let say Rewind ( TRequestStatus &, TUint &, TRemConCoreApiButtonAction )) completes successfully? If yes then you can check what status code it returns.

  9. #9
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Control native music player

    Yes, and it returns 4294967291 ... Do you have any idea what this could be? knowing that this is the same number for other functions that works properly (Play , pause , vol up / down ).
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,745

    Re: Control native music player

    Your number is 0xFFFFFFFB. If it happens to be in a TRequestStatus, it is -5, KErrNotSupported.

  11. #11
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Control native music player

    Thank you Wizard for clearing this up, but how I receive the same number even with successful functions (volume up / down - play - pause - next - previous) ?
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,745

    Re: Control native music player

    Yes, I saw that part too, but I do not know the answer.

Similar Threads

  1. Controlling the native music player from an application
    By damsku in forum Symbian Media (Closed)
    Replies: 11
    Last Post: 2010-12-23, 10:31
  2. How to Hide Native Music player Application from Task List ?
    By mail2karthi07 in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2010-10-13, 08:12
  3. How to control Native music player play button and pause buton ?
    By mail2karthi07 in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2010-10-07, 06:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×