Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Killing player when invoked from Content handler

[ Edited ]

Hi,

 

I have run the CHAPI demo example provided with the JDE samples.

 

I have one query , when i press the back key control returns to my application , but the song keeps on playing.

 

I want to kill that song,but dont know how to do it.

 

Please suggest.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi,

 

Please anybody, need some inputs to start with.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi All,

 

Please any inputs.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

Re: Killing player when invoked from Content handler

As per my understanding you want to stop the player application when you click on the return key on your device. Right?

 

Firstly, you will have to get the instance of the player which is playing the song. Then you need to call the player instance's stop() method to stop the player.

 

Hope this helps.

Saket

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi Saket,

 

Thanks for the reply, but i guess you misunderstood my question.

 

I have started the player using invocation method and registring it through registy.

 

Now player is played outside my application, when i press the backkey on device , control is returned to my application , but song continues playing , how to stop that song.

 

Please suggest.

 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

Re: Killing player when invoked from Content handler

is it possible for you to post the code snippet where you are starting the player via invocation?

 

apart from that you can try to kill the camera application by using an EventInjector class.

 

The sample code for the same is as below:

 

public void closePlayer()

{

   try

   {

    EventInjector.KeyEvent inject = new EventInjector.KeyEven  (EventInjector.KeyEvent.KEY_DOWN,Characters.ESCAPE,1 , 50);
        inject.post();
        inject.post();

   }

 catch(Exception ex){}

}

 

i am not sure if this will do the trick but its just a guess.......

 

Hope it helps,

Saket

 

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi Saket,

 

Thanks , but actually i am invoking player directly using method described in CHAPI demo example,

 

Now when i press back key on device , i want to kill the player, but as control is out of my application i will not be able to catch back key, is there any way of catching the back key.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi,

 

Any help on this Smiley Sad

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Killing player when invoked from Content handler

You can just play another sound and it will stop the first player on CDMA, or you could play 2 on GSM. That's the trick I use in one of my apps, I just have a blank audio file that I play whenever I want to kill the audio.

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Killing player when invoked from Content handler

Hi,

 

but i am using invocation method to play , so if i play blank audio file will it not show player screen.

 

or i should play blank audio file using j2me player

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish