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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Opening media player

I have music to play, I can play it like this

 

HttpConnection google = (HttpConnection)javax.microedition.io.Connector.open(m.getTrailer()+";deviceside=true");
                                        
                                            InputStream is = google.openInputStream();
                                            GlobalValue.RadioPlayer = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");
                                            GlobalValue.RadioPlayer.realize();
                                            GlobalValue.RadioPlayer.prefetch();
                                            GlobalValue.RadioPlayer.start();

 

 

But I dont want just to play it, i want to open media player with it...and open there music there.how can it be done?

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

One more thing, this works on simulator but not device..

HttpConnection google = (HttpConnection)javax.microedition.io.Connector.open(m.getTrailer()+";deviceside=true");

InputStream is = google.openInputStream();
GlobalValue.RadioPlayer = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");
GlobalValue.RadioPlayer.realize();
GlobalValue.RadioPlayer.prefetch();
GlobalValue.RadioPlayer.start();
trailer = m.getTrailer();
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

the last issue was solved, i had to add interface=wifi; instead of deviceide=true;

however i still need to know how to open mp3 file in media player.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

[ Edited ]

One way to solve issue

 

Browser.getDefaultSession().displayPage("http:/192....song.mp3");
                                    

 

 

instead of

 

HttpConnection google = (HttpConnection)javax.microedition.io.Connector.open(m.getTrailer()+";interface=wifi;deviceside=true");
											    
										        	InputStream is = google.openInputStream();
										        	GlobalValue.RadioPlayer = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");
										        	GlobalValue.RadioPlayer.realize();
										        	GlobalValue.RadioPlayer.prefetch();
										        	GlobalValue.RadioPlayer.start();

 

 

 

when i do that, it opens browser and asks to save or open the file?

when clicks open,  it opens this http://postimage.org/image/gxuipgszf/

 

I want to open that directly from my code, without opening browser and workaround.

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

[ Edited ]

If I do this, it opens a black screen page..and plays the music tho.

 

public class Screen extends MainScreen {
	
	
	public Screen(String p) throws IOException, MediaException
	{
p="http://192.168.0.150/MediaPreview/396.mp3";
 HttpConnection google = (HttpConnection)javax.microedition.io.Connector.open(p+";interface=wifi;deviceside=true"); InputStream is = google.openInputStream(); Player player = javax.microedition.media.Manager.createPlayer(is, "Video/mpeg"); player.realize(); VideoControl videoControl = (VideoControl) player.getControl("VideoControl"); Field videoField = (Field)videoControl.initDisplayMode( VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" ); videoControl.setDisplayFullScreen(true); videoControl.setVisible(true); add(videoField); player.start(); } }

 

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

[ Edited ]
Invocation media = new Invocation("http://11.23.45.6/song.mp3");
Registry rg = Registry.getRegistry(getClass().getName());
rg.invoke(media);


 

 

this  does nthg

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

if I do this it works

Invocation invocation = new Invocation("file:///SDCard/BlackBerry/videos/Sleep Away.mp3");

// Get the content handler for the media
Registry _registry=Registry.getRegistry("net.rim.device.api.content.BlackBerryContentHandler");

//Invoke the content handler.
_registry.invoke(invocation);


but i replace it with a url like http://11.23.45.6/song.mp3 it doesnt work
Highlighted
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Opening media player

Okey I am using  blackberry jre 7.0.0

 

Invocation invocation = new Invocation("rtsp:?/");

// Get the content handler for the media
Registry _registry=Registry.getRegistry("net.rim.device.api

.content.BlackBerryContentHandler");

//Invoke the content handler.
_registry.invoke(invocation);
If  I use rtsp link the media player opens successfully, but on http it doesnt open.
so is there a way to do it for http? or  is it not supported by blackberry?