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
Highlighted
Developer
Posts: 21
Registered: ‎01-07-2009
My Device: Not Specified
Accepted Solution

Streaming media files using Manager.createPlayer()

Hey guys,

quick question...

I have my app connect to the internet via ";interface=wifi",

and I stream media files using

Player p = Manager.createPlayer("http://somelocation/blah.mp3"); p.start();

 

 

Whenever I run it, it throws an exception: "Bad Tunnel". If I add ";interface=wifi" to the end of the url, it says that it is a bad URL.

 

Is there anyway to force the Player to stream using the wi-fi connection?

 

For some reason when I use the buffered playback example, when the player is told to stop, it will stop the playback but it keeps downloading the rest of the file when I call destroy() and even when I forcefully stop & close every single stream involved. This becomes a problem since other Players on the same screen won't start streaming until the first stream has finished downloading.

BlackBerry Development Advisor
Posts: 15,264
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Streaming media files using Manager.createPlayer()

Using ;interface=wifi should work in a URL used in the createPlayer method.  What BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.  Is the BlackBerry handheld connected to a Wi-Fi network at the time?  Note that the BlackBerry Simulator does not support Wi-Fi simulation.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 21
Registered: ‎01-07-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Mark,

Yeah I'm an **bleep**. I was pulling my hair for a couple hours, it turned out I put ":interface=wifi" instead of ";interface=wifi".

I didn't notice because I stored ":interface=wifi" as a String in a utility class and didn't look there until I took a break for a whole day and cleared my head.

Developer
Posts: 93
Registered: ‎08-17-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Hi,

 

I am trying to Stream Audio or Video file from my server location and run it on simulator. I used the following code pasting it here for sample.

 

 public void PlayVideo() {
        try {
            Player p = Manager.createPlayer("http://localhost/whistle.mp3");
            p.start();
        }
        catch (MediaException me) {
            System.out.println(me);
            }catch (Exception ex) {
            System.out.println(ex);
            }
        }
    }

 

But this code gets executed, but doesn't do anything, i mean doesn't run this file. I could able to run this from my I.E as i have installed Apache server in my computer.

 

I have BlackBerry 4.7 JDE. BlackBerry default Smartphone Simulator comes with JDE version  2.11.

 

Please help me what i'm doing wrong here, as i need to help immediately.

 

Thanks.

 

Martin.

 

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Instead of localhost, try using your IP or comp name.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 93
Registered: ‎08-17-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Hi,

 

Appreciate for your suggestion.

I tried giving IP address instead of localhost, but still doesn't run my .mp3 or .mpg file in Simulator.

 

Please give me some other solution. Need help.

Developer
Posts: 93
Registered: ‎08-17-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

hi,

 

 

I'm also having the following doubts, could you clarify that?

 

For streaming Video and Audio, can i use this function as i mentioned in my sample above comment (or) is this not the way of streaming video and audio files in latest BB devices?

What is about RTSP protocol and difference between them?

What could be the reason that i am not able to run my sample .mp3 or .mpg video file programmatically in simulator media? Is my code is correct to just launch Media app in simulator and run the retrieved media file?

Please advice me.

thanks.

Developer
Posts: 93
Registered: ‎08-17-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Hi,

 

As i said earlier in my comment as 'This code gets executed' doesn't happen actually. I just checked it. During execution of my code snippet it gets stuck at "Manager.createPlayer" funtion call..after that doesn't move, i need to force exit the simulator.

 

            Player p = Manager.createPlayer("http://192.168.0.103/whistle.mp3");
            p.start();

 

Giving update here so that it may help someone to explain me about the exact problems(Player not running on Simulator) that i'm facing.

 

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

Waht is teh Simulator JDE you trying on? There are good discussions about RTSP also in this forum.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 93
Registered: ‎08-17-2009
My Device: Not Specified

Re: Streaming media files using Manager.createPlayer()

thanks.

 

I'm using BlackBerry JDE 4.7.0 and default simulator comes with that. Simulator shows: BB 9530 Simulator. In About, it shows BlackBerry Smartphone SImulator 2.11.0.86.

 

I am not downloading any Live streaming video or audio, so i thought i may not be needed using RTSP. And i thought using RTSP is tough than playing using createPlayer and start it.

Pleae advice me in detail steps for the problems that i'm facing with the current code and then if i use RTSP, what are the benefits that i will get and how to use RTSP code as per the steps?