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
New Developer
Posts: 16
Registered: ‎12-18-2008
My Device: Not Specified

Exit native Blackberry media player

Hi,

 

I have used invocation method (JSR 211) to invoke native BB media player from my UI application. When I click on back button, the media player goes in background, it does not exit.

 

Normally, when I open media player manually, it exits on back button.

 

Is there any way to exit the media player?

 

Code snippet:

 

invocation = new Invocation("file:///SDCard/BlackBerry/videos/2100.3gp",null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER,false,null);
invocation.setResponseRequired(true);
registry = Registry.getRegistry("HelloWorldDemo");
try {
    registry.invoke(invocation);
 } catch (Exception ec) {
     System.out.println("Exception---------------------1"+ec);
 }

 

 

Regular Contributor
Posts: 61
Registered: ‎08-11-2010
My Device: Not Specified

Re: Exit native Blackberry media player

I am facing a similar issue. These were the steps i did:

 

* imported net.rim.device.api.content.BlackBerryContentHandler

* Invocation invocation = new Invocation("file://"+voicePath); //a voicenote file path
   Registry reg = Registry.getRegistry("com.labs.main.MyAppMainClass");

 

But when i use the back button to exit the media player, the file doesn't stop playing. But when i open the player nowmally from outside my app, it exits well on coming back. Any help is much appreciated. Thankyou

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Exit native Blackberry media player

For both of you: My media player doesn't stop playing music for me when I hit the back button so I don't know why yours would be.

 

As for closing it, I don't know if this will solve anything (or just do the same result as the back button) and requires 5.0 and higher but if you get the current application (which should be the media player) you can call Application.requestClose() to close the application.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
New Developer
Posts: 16
Registered: ‎12-18-2008
My Device: Not Specified

Re: Exit native Blackberry media player

Hi,

 

On the 1st back click, it exits from fullscreen mode to normal mode (where the media keeps playing). On the 2nd back click/, the player goes in background.

 

Br,

Akash.

Regular Contributor
Posts: 61
Registered: ‎08-11-2010
My Device: Not Specified

Re: Exit native Blackberry media player

Thanks a lot rcmaniac25. I agree with you on the media player. The audio wont stop if you exit the player using the back button. But in my case, i play a voicenote. And if I normally play a voice note and exit using the back button it stops playing the file too. Thats why i need help on it. Thankyou.

New Developer
Posts: 16
Registered: ‎12-18-2008
My Device: Not Specified

Re: Exit native Blackberry media player

Could anyone solve this issue?

 

Plz help.

 

Thanks,

Akash.

New Developer
Posts: 50
Registered: ‎03-18-2009
My Device: 8530
My Carrier: Movilnet

Re: Exit native Blackberry media player

I think that you have to pass false here:

 

invocation.setResponseRequired(false);

 


// Code for getting Thanks
if( iWasHelpful && solvedYourProblem ) {
Thanks++;
solution = true;
}