Control native music player
[I]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]
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 [url]http://www.developer.nokia.com/Commu...te_Control_API[/url] 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 [url]http://www.developer.nokia.com/Commu...ymbian_C%2B%2B[/url], this though unfortunately it seems does not support media keys. Lastly though I have found a working way to listen for these keys through [url]http://www.developer.nokia.com/Commu...ing_media_keys[/url] 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.
Re: Control native music player
from : [url]http://library.developer.nokia.com/index.jsp?topic=/Nokia_Belle_Developers_Library/GUID-C6E5F800-0637-419E-8FE5-1EBB40E725AA/GUID-5DFC3A65-5AED-3DA5-825A-78AE857109ED.html[/url] 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.
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::processEvents(): 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
Re: Control native music player
[QUOTE=Gerhman.dc;905683]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[/QUOTE]
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.
Re: Control native music player
Thanks again but I got it working by simply adding:
User::WaitForRequest(aStatus);
Re: Control native music player
[QUOTE=Gerhman.dc;905685]Thanks again but I got it working by simply adding:
User::WaitForRequest(aStatus);[/QUOTE]
ok, strange error then, basically with symbia you should get Stray signal panic for the mistake..
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.
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.
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 ).
Re: Control native music player
Your number is 0xFFFFFFFB. If it happens to be in a TRequestStatus, it is -5, KErrNotSupported.
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) ?
Re: Control native music player
Yes, I saw that part too, but I do not know the answer.