In MP3 player how to handle call interruption
| Wed, 2008-04-02 06:43 | |
|
Hi, I am developing a MP3 player. I am using CMdaAudioPlayerUtility. I want to add a functionality in which, if a call comes while a file is playing, the file should pause the current playing file, and when the player will resume should be in pause state. But in present scenario the player stops when the call comes and when the call is complete, the player resumes but it goes to its initial stage (one needs to again select a file,open, play....) I dont know how to check when a call is coming and where to add pause. Can anybody tell me how to do this?? |
|






Forum posts: 2
Check out this link...
this may help you...
http://wiki.forum.nokia.com/index.php/CS000863_-_Pausing_an_application_on_an_incoming_call
you just need to write the code to pause the player in the RunL() function of the code snippet...
Forum posts: 18
I have seen this code previously ,but my code dosen't have any (Active object ) RunL().
Where to add , the code to pause an application.
When the call will come from which part of code it will switch ( I think "appui" but then in which function ) ?
Forum posts: 2
I think, you can't do it without Active Objects.
Forum posts: 24
The logic is simple u ve to register a callback with the telephony server and when the status changes it ll call the callback.
void CTelObserver::StartListening()
{
iTelephony->NotifyChange(iStatus, CTelephony::EVoiceLineStatusChange,
iCallStatusPkg);
SetActive();
}
when do this u ve registered the callback by giving ur iStatus. when the status changes ur runl ll be called .simple
just copy paste this code
http://wiki.forum.nokia.com/index.php/CS000863_-_Pausing_an_application_on_an_incoming_call
It should work .
Forum posts: 18
Hey I have included the "TelObserver.h" and "TelObserver.cpp" file mentioned in the link.
Then I have created an instance of this class in my "AppUi.cpp" and called the function StatrtListening.
CTelObserver* iTelObs;
iTelObs = CTelObserver::NewL();
iTelObs->StartListening();
I have buid the application and installed the "sis" file on my mobile (Nokia 6630 ).
On starting the application, it gives "System error" and dosent open the application.
I dont know what has to be added more. I am using active oject for the first time.
Where I am going wrong??
Forum posts: 24
I think u r mixing too many things.First of all System error does not ve to do anything with active objects.
which sdk are u using to build the .sis file? and also check that all the linked libs are there in the pkg file.
Forum posts: 18
I am using s60 2nd edition FP2.
And my package file look like this.
&EN
#{"Sound Example"},(0x10005BC6),1,0,0
(0x101F7960), 0, 0, 0, {"Series60ProductID"}
; Target
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\sound.app" -"!:\system\apps\sound\sound.app"
"$(EPOCROOT)Epoc32\data\z\system\apps\Sound\Sound.rsc" -"!:\system\apps\Sound\Sound.rsc"
"$(EPOCROOT)Epoc32\data\z\system\apps\Sound\Sound.aif" -"!:\system\apps\Sound\Sound.aif"
"$(EPOCROOT)Epoc32\data\z\system\apps\Sound\Sound_caption.rsc" -"!:\system\apps\Sound\Sound_caption.rsc"
I have checked all possble conditions.
I have changed included corresponding library ( etel3rdparty.lib ) "mmp" file.
Now the application is not giving "system error" problem, but the application is not opening.
Forum posts: 18
Hey I have tried removing active object from the application and run, then the application is running very fine.
So creating active object is giving some problem. Might be I am using active object in the wrong way.
When I added active object then, the application is not opening only.
Although it dosent give any error, but its not opening also.
Can you suggest what might be going wrong?
Forum posts: 463
Well, this might help you get some sensible errors to point you where things might be going wrong :
http://wiki.forum.nokia.com/index.php/Extended_panic_code
Forum posts: 18
Hey I was using CTelephony class in Fp2, 2nd edition I suppose that is why it was giving problem.
Now I am using Rcall class, with active objects it is running properly, i.e if a player is playing and a call comes then the player pauses and when the call is complete then the player starts from the position where it was stopped.
But when the player is playing in background (if the player window is not on the screen) and a call comes , then after the call completes, player starts playing from the starting (instead of the position from where it was stopped ). Why this is happening cant get it???
if(aLineStatus==RCall::EStatusRinging){
Pause the player;
}
Forum posts: 463
I havent done this, but I think when you pause the player, you have to GetPosition() and when you resume you SetPosition()..dunno really, but you can look at it that way and check if it works
Forum posts: 18
But then how come it is working when the player window is on the main screen.
It is not working when the player plays on background.
Actually the pause function of CMdaAudioPlayerUtility is working, I have checked that.
Anyways I will check with this also. Thanks.
Forum posts: 18
Hey I have tried with Getposition and setposition but it is also not working for background pause.
if(aLineStatus==RCall::EStatusRinging)
{
Pause the player;
Get the position;
}
if(aLineStatus==RCall::EStatusIdle)
{
Set the position
}
I have checked various possibilties (nearly all ) but its not working.
I am using Nokia 6600 for testing.
Forum posts: 1
have u set the player to run in the background and incomming call to run in foreground
Forum posts: 2
Use RegisterAudioResourceNotification(), WIllresumePlay() to register the application for any notification when a Higher priority triggers ( for example Voice call ). So after the voice call you will get the notificatiocation
And resume the play ..